Guest User

Untitled

a guest
Oct 21st, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <AccelStepper.h>
  2.  
  3. // Define a stepper and the pins it will use
  4. AccelStepper stepper(AccelStepper::DRIVER, 13, 12);
  5.  
  6. int pos = 3600;
  7.  
  8. void setup()
  9. {
  10. stepper.setMaxSpeed(500);
  11. stepper.setAcceleration(1000);
  12. }
  13.  
  14. void loop()
  15. {
  16. if (stepper.distanceToGo() == 0)
  17. {
  18. delay(500);
  19. pos = -pos;
  20. stepper.moveTo(pos);\
  21. }
  22. stepper.run();
  23. }
Add Comment
Please, Sign In to add comment