Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <AccelStepper.h>
- // Define a stepper and the pins it will use
- AccelStepper stepper(AccelStepper::DRIVER, 13, 12);
- int pos = 3600;
- void setup()
- {
- stepper.setMaxSpeed(500);
- stepper.setAcceleration(1000);
- }
- void loop()
- {
- if (stepper.distanceToGo() == 0)
- {
- delay(500);
- pos = -pos;
- stepper.moveTo(pos);\
- }
- stepper.run();
- }
Add Comment
Please, Sign In to add comment