Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.84 KB | None | 0 0
  1. void loop(){
  2.  
  3.   if(digitalRead(switchPin) == HIGH){
  4.     moveF(587);
  5.     turnR(170);
  6.     moveF(587);
  7.     turnR(170);
  8.     moveF(587);
  9.     turnR(170);
  10.     moveF(587);
  11.     turnR(170);  
  12.   }
  13. }
  14.  
  15. void moveF(volatile unsigned int countR){
  16.   ticks = 0;
  17.   for(int i - 0; i < countR; i++){
  18.     leftMotor(255);
  19.     rightMotor(255);
  20.   }
  21.  leftMotor(0);
  22.  rightMotor(0);
  23.  delay(500)
  24. }
  25.  
  26. void turnL(volatile unsigned int countR){
  27.   ticks = 0;
  28.   for(int i - 0; i < countR; i++){
  29.     leftMotor(-255);
  30.     rightMotor(255);
  31.   }
  32.  leftMotor(0);
  33.  rightMotor(0);
  34.  delay(500)
  35. }
  36.  
  37. void turnR(volatile unsigned int countR){
  38.   ticks = 0;
  39.   for(int i - 0; i < countR; i++){
  40.     leftMotor(255);
  41.     rightMotor(-255);
  42.   }
  43.  leftMotor(0);
  44.  rightMotor(0);
  45.  delay(500)
  46. }
  47.  
  48. void rMotorCount(){
  49.   countR++;
  50. }
  51. void lMotorCount(){
  52.   countL++;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement