/* A simple line following program. It works with the standard NXT bot. Place the bot on the test pad, with the wheels on the start line facing forward. Then start the program. author: Jan-Klaas Kollhof last changed by: $LastChangedBy$ last changed date: $Date$ revision: $Revision$ */ #define LightThreshold 50 #define Fast 75 #define Slow 30 task main(){ SetSensorLight(IN_3); //lets turn 90 deg left RotateMotorEx(OUT_BC, Fast, 180,-100, true, false); //now follow the line OnFwd(OUT_BC, Fast); while(1){ if(Sensor(IN_3) > LightThreshold){ //we just went off of the black line //so lets slow down on the right OnFwd(OUT_B, Slow); }else{ OnFwd(OUT_B, Fast); } } }