Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. // Arduino stepper motor control code
  2.  
  3. #include <Stepper.h> // Include the header file
  4.  
  5. // change this to the number of steps on your motor
  6. const int STEPS = 600;
  7.  
  8. // create an instance of the stepper class using the steps and pins
  9. Stepper stepper(STEPS, 8, 10, 9, 11);
  10.  
  11.  
  12.  
  13. void setup() {
  14. stepper.setSpeed(60);
  15. Serial.begin(9600);
  16.  
  17. }
  18.  
  19. void loop() {
  20. Serial.println("clockwise");
  21. stepper.step(STEPS);
  22. delay(500);
  23.  
  24. Serial.println("counterclockwise");
  25. stepper.step(-STEPS);
  26. delay(500);
  27.  
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement