Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // definir a distância do objeto
- task main()
- {
- SetSensor(S2, SENSOR_COLORRED);
- SetSensor(S3, SENSOR_COLORRED);
- SetSensorLowspeed(IN_1);
- while(true)
- {
- if(Sensor(IN_2)>60 && Sensor(IN_3)>60) // ao ver branco, andar pra frente
- {
- OnFwd(OUT_AC, 75);
- Wait(100);
- }
- else if(Sensor(IN_2)>20 && Sensor(IN_3)>60) // sensor 2, ao ver preto, desacelera lado DIREITO do robô
- {
- OnFwd(OUT_A, 75);
- OnFwd(OUT_C, 10);
- }
- else if(Sensor(IN_2)>60 && Sensor(IN_3)>20) // sensor 3, ao ver preto, desacelera lado ESQUERDO do robô
- {
- OnFwd(OUT_A, 10);
- OnFwd(OUT_C, 75);
- }
- //else if(Sensor(IN_1)>20)
- //{
- //OnRev(OUT_AC, 75);
- //Wait (50);
- //}
- }
- }
Add Comment
Please, Sign In to add comment