Created
October 21, 2018 21:58
-
-
Save TarikTz/a4ee651c453a6772a812127a98857dd4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment