Advertisement
Kl43z

ROBOT FINAL / CAMBIAR VALORES

Oct 27th, 2014
162
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. sub vuelta(){
  2. Off(OUT_AB);
  3.  
  4. OnFwd(OUT_A,50);
  5. OnRev(OUT_B,47) ;
  6. Wait(400);
  7. }
  8. sub avanzar(){
  9. OnFwd(OUT_A,60);
  10. OnFwd(OUT_B,57);
  11. }
  12.  
  13.  
  14.  
  15.  
  16. task main(){
  17.  
  18.  
  19. SetSensorLight (IN_2);
  20. SetSensorLowspeed (IN_4);
  21.  
  22. while (TRUE)
  23. {
  24.  
  25. NumOut(5,5,SensorUS(IN_4));
  26. if (SensorUS(IN_4)<=15) {
  27. Off(OUT_AB);
  28. Wait(1000);
  29. OnRev(OUT_AB,50);
  30. Wait(400);
  31. vuelta();
  32. Wait(1000);
  33. }
  34. else
  35. {
  36.  
  37. if(SENSOR_2<=60)
  38. {
  39. Off(OUT_AB);
  40. OnFwd(OUT_A,40);
  41. OnFwd(OUT_B,0);
  42. }
  43. else
  44. {
  45. Off(OUT_AB);
  46. OnFwd(OUT_B,40);
  47. OnFwd(OUT_A,0);
  48. }
  49.  
  50. }
  51.  
  52.  
  53. }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement