gabbyshimoni

Nema17wTB6600

Jan 27th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <AccelStepper.h>
  2.  
  3.  
  4. // Define a stepper motor 1 for arduino
  5. // direction Digital 9 (CW), pulses Digital 8 (CLK)
  6. AccelStepper stepper(1, 8, 9);
  7. void setup()
  8. {
  9. // Change these to suit your stepper if you want
  10. stepper.setMaxSpeed(1000);//1100
  11. stepper.setAcceleration(1100);
  12. stepper.moveTo(2000);
  13. }
  14.  
  15. void loop()
  16. {
  17. // If at the end of travel go to the other end
  18. if (stepper.distanceToGo() == 0){
  19. stepper.moveTo( -stepper.currentPosition() );
  20. }
  21.  
  22. stepper.run();
  23. }
Add Comment
Please, Sign In to add comment