-
-
Save JeffersGlass/2776e68550f046925634ed6dc486d7d8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 <Stepper.h> | |
// change this to the number of steps on your motor | |
#define STEPS 180 | |
// create an instance of the stepper class, specifying | |
// the number of steps of the motor and the pins it's | |
// attached to | |
Stepper stepper(STEPS, 8, 9, 10, 11); | |
int switchpin = 4; | |
// the previous reading from the analog input | |
int previous = 0; | |
int currentPostion = 0; | |
void setup() { | |
// set the speed of the motor to 4 RPMs | |
stepper.setSpeed(5); | |
while (digitalRead(switchpin) == HIGH){ //homing routine | |
stepper.step(-1); | |
} | |
stepper.setSpeed(30); | |
delay(1000); | |
stepper.step(STEPS * 4); | |
} | |
void loop() { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment