sub initialize() {
SetSensor(BUMP_SENSOR, SENSOR_TOUCH);
SetSensor(LIGHT_SENSOR, SENSOR_LIGHT);
ClearMessage();
score = 0;
Fwd(OUT_B);
SelectDisplay(5);
calibrateLightSensor();
}
#define NUMBER_OF_SAMPLES 10
int i;
int runningTotal;
void calibrateLightSensor() {
// Take an average light reading.
i = 0;
runningTotal = 0;
while (i < NUMBER_OF_SAMPLES) {
runningTotal += LIGHT_SENSOR;
Wait(10);
i += 1;
}
averageLight = runningTotal / NUMBER_OF_SAMPLES;
}
Online Resources
mattdm's Mindstorms stuff
http://www.mattdm.org/mindstorms/
This is the original RoboTag web page, created by Matthew Miller. It contains the original source code and a couple of movies of RoboTag in action.
Brooks' Subsumption Architecture
http://ai.eecs.umich.edu/cogarch3/Brooks/Brooks.html
This page has some background on subsumption architecture. If you really want to learn more, however, you should look up Brooks' papers; they're an excellent read.
10
legOS
Page 188
Page 189
Need help?
Do you have a question about the MINDSTORMS Robots and is the answer not in the manual?
Questions and answers