Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define INPUT_REDCOLOR 5
- #define INPUT_GREENCOLOR 3
- task main(){
- // white==48; apenas para decorar
- // black==18;
- SetSensor(S2, SENSOR_COLORRED);
- SetSensor(S3, SENSOR_COLORFULL);
- while(true)// loop infinito
- {
- if( Sensor(IN_2)>13 && Sensor(IN_2)<35) // se o sensor que fica encima da linha ver algo escuro, ir para frente
- {
- OnFwd(OUT_AC, 70);
- until(Sensor(IN_2)<35);
- if(Sensor(IN_2)>35)
- {
- OnFwd(OUT_A, 50);
- until(Sensor(IN_2)<30);
- }
- else if(Sensor(IN_3) == 3) // se o sensor de cor ver verde, ir para o verde
- {
- OnFwd(OUT_A, 50);
- OnRev(OUT_C, 20);
- until(Sensor(IN_2)>30);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment