that_one_nigga_you_k

robô carai

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