int motorB,motorC,y; task main () { SetSensorColorRed(S1); SetSensorColorRed(S2); SetSensorLowspeed(S3); Wait(3000); int L1=SENSOR_1; int L2=SENSOR_2; TextOut(0,0,"111"); Wait(6000); ClearScreen(); int G1=SENSOR_1; TextOut(0,0,"222"); Wait(6000); ClearScreen(); int G2=SENSOR_2; TextOut(0,0,"333"); Wait(6000); ClearScreen(); y=SENSOR_1-SENSOR_2; while((SENSOR_1<(L1-2))&&(SENSOR_2<(L2-2))) { if((abs(SENSOR_1-G1))<2) { Off(OUT_BC); SetSensorColorFull(S1); if(SENSOR_1==3) { RotateMotor(OUT_BC,100,200); RotateMotorEx(OUT_BC,100,280,100,true,true); RotateMotor(OUT_BC,100,100); } else { RotateMotorEx(OUT_BC,100,80,100,true,true); } SetSensorColorRed(S1); } if((abs(SENSOR_2-G2))<2) { Off(OUT_BC); SetSensorColorFull(S2); if(SENSOR_2==3) { RotateMotor(OUT_BC,100,200); RotateMotorEx(OUT_BC,100,280,-100,true,true); RotateMotor(OUT_BC,100,100); } else { RotateMotorEx(OUT_BC,100,80,-100,true,true); } SetSensorColorRed(S2); } if(SensorUS(S3)<10) { PlayTone(4500,500); RotateMotor(OUT_BC,100,90); RotateMotor(OUT_B,100,300); RotateMotor(OUT_BC,100,800); RotateMotor(OUT_BC,-100,800); RotateMotor(OUT_B,-100,200); } motorB=50+3*(SENSOR_1-SENSOR_2-y); motorC=50-3*(SENSOR_1-SENSOR_2-y); if((motorB<30)&&(motorB>-30))motorB=-30; if((motorC<30)&&(motorC>-30))motorC=-30; if(motorB>70)motorB=70; if(motorC>70)motorC=70; if(motorB<-70)motorB=-70; if(motorC<-70)motorC=-70; OnFwd(OUT_B,motorB); OnFwd(OUT_C,motorC); } Off(OUT_BC); PlayTone(4500,500); Wait(1000); RotateMotor(OUT_BC,100,400); RotateMotor(OUT_C,100,515); RotateMotor(OUT_BC,100,1200); RotateMotor(OUT_BC,-100,250); RotateMotor(OUT_B,100,515); RotateMotor(OUT_BC,100,235); RotateMotor(OUT_B,100,515); RotateMotor(OUT_BC,100,1200); RotateMotor(OUT_BC,-100,250); RotateMotor(OUT_C,100,515); RotateMotor(OUT_BC,100,350); RotateMotor(OUT_BC,100,-200); RotateMotor(OUT_C,100,515); RotateMotor(OUT_BC,100,1000); }