that_one_nigga_you_k

robo.segue.linha/um sensor de luz

Jun 28th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #define INPUT_REDCOLOR 5
  2. #define INPUT_GREENCOLOR 3
  3.  
  4. task main(){
  5. // white==48; apenas para decorar
  6. // black==18;
  7. SetSensor(S2, SENSOR_COLORRED);
  8. SetSensor(S3, SENSOR_COLORFULL);
  9.  
  10. while(true)// loop infinito
  11. {
  12. if( Sensor(IN_2)>13 && Sensor(IN_2)<35) // se o sensor que fica encima da linha ver algo escuro, ir para frente
  13. {
  14. OnFwd(OUT_AC, 70);
  15. until(Sensor(IN_2)<35);
  16.  
  17. if(Sensor(IN_2)>35)
  18. {
  19. OnFwd(OUT_A, 50);
  20. until(Sensor(IN_2)<30);
  21. }
  22.  
  23. else if(Sensor(IN_3) == 3) // se o sensor de cor ver verde, ir para o verde
  24. {
  25. OnFwd(OUT_A, 50);
  26. OnRev(OUT_C, 20);
  27. until(Sensor(IN_2)>30);
  28. }
  29. }
  30.  
  31.  
  32. }
  33. }
Add Comment
Please, Sign In to add comment