[[2005/C4]] - Run along the wall #define L OUT_A #define R OUT_C #define SS SENSOR_1 #define SF SENSOR_3 //side sensor ->Right int stats=0; int statf=0; task main(){ SetSensor(SS,SENSOR_TOUCH); SetSensor(SF,SENSOR_TOUCH); OnFwd(R+L); while(true){ if(SS!=stats){ stats=SS; if(stats==0){ Off(R); }else{ OnFwd(R); } }else if(SF!=statf){ statf=SF; if(statf==1){ turn_left(); }else{ OnFwd(L+R); } } } } sub turn_left(){ Off(L+R); OnRev(L+R); Wait(70); OnFwd(R); Off(L); Wait(70); OnFwd(L+R); while(SF!=0 && SS!=0){ while(SS==0 && SF==0); } OnFwd(L+R); }