that_one_nigga_you_k

robô pt2.

Jun 22nd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. // definir a distância do objeto
  2.  
  3. task main()
  4. {
  5. SetSensor(S2, SENSOR_COLORRED);
  6. SetSensor(S3, SENSOR_COLORRED);
  7. SetSensorLowspeed(IN_1);
  8.  
  9. while(true)
  10. {
  11.  
  12. if(Sensor(IN_2)>=60 && Sensor(IN_3)>=60) // ao ver branco, andar pra frente
  13. {
  14. OnFwd(OUT_AC, 75);
  15. Wait(100);
  16. }
  17.  
  18. else if(Sensor(IN_2)<=20 && Sensor(IN_3)>=60) // sensor 2, ao ver preto, desacelera lado DIREITO do robô
  19. {
  20. OnFwd(OUT_A, 75);
  21. Wait(100);
  22. OnFwd(OUT_C, 10);
  23. Wait(100);
  24. }
  25.  
  26. else if(Sensor(IN_2)>=60 && Sensor(IN_3)<=20) // sensor 3, ao ver preto, desacelera lado ESQUERDO do robô
  27. {
  28. OnFwd(OUT_A, 10);
  29. Wait(100);
  30. OnFwd(OUT_C, 75);
  31. Wait(100);
  32. }
  33.  
  34. //else if(Sensor(IN_1)>20)
  35. //{
  36. //OnRev(OUT_AC, 75);
  37. //Wait (50);
  38. //}
  39.  
  40. }
  41.  
  42.  
  43. }
Add Comment
Please, Sign In to add comment