Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. const int motorA = 5;
  2. const int motorB = 6;
  3. const int dirA = 7;
  4. const int dirB = 8;
  5.  
  6. void setup() {
  7. pinMode(motorA, OUTPUT);
  8. pinMode(motorB, OUTPUT);
  9. pinMode(dirA, OUTPUT);
  10. pinMode(dirB, OUTPUT);
  11. }
  12.  
  13. void loop() {
  14.  
  15. digitalWrite(dirA, HIGH);
  16. digitalWrite(dirB, HIGH);
  17. analogWrite(motorA, 150);
  18. analogWrite(motorB, 150);
  19.  
  20. delay(1000);
  21.  
  22. analogWrite(motorA, 0);
  23. analogWrite(motorB, 0);
  24.  
  25. delay(1000);
  26.  
  27. digitalWrite(dirA, LOW);
  28. digitalWrite(dirB, LOW);
  29. analogWrite(motorA, 150);
  30. analogWrite(motorB, 150);
  31.  
  32. delay(1000);
  33.  
  34. analogWrite(motorA, 0);
  35. analogWrite(motorB, 0);
  36.  
  37. delay(1000);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement