Advertisement
Guest User

arduino

a guest
Jul 25th, 2013
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.61 KB | None | 0 0
  1.  
  2. #include <AFMotor.h>
  3.  
  4. // DC motor on M2
  5. AF_DCMotor motor1(3);
  6. AF_DCMotor motor2(4);
  7.  
  8. void setup() {
  9. motor1.run(RELEASE);
  10. delay(60);
  11. motor2.run(RELEASE);
  12. delay(60);
  13. motor1.setSpeed(235);
  14. delay(60);
  15. motor2.setSpeed(235);
  16.  
  17.  
  18. }
  19.  
  20.  
  21. void loop() {
  22.   delay(60);
  23.   motor1.run(FORWARD);
  24.   delay(60);
  25.   motor2.run(FORWARD);
  26.  
  27.  
  28.   delay(2000);
  29.  
  30.   motor1.run(RELEASE);
  31.   delay(60);
  32.   motor2.run(RELEASE);
  33.   delay(3000);
  34.  
  35.  
  36.   motor1.run(BACKWARD);
  37.   delay(60);
  38.   motor2.run(BACKWARD);
  39.   delay(3000);
  40.  
  41.  
  42.   motor1.run(RELEASE);
  43.   delay(60);
  44.   motor2.run(RELEASE);
  45.   delay(3000);
  46.  }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement