20 lines
417 B
C++
20 lines
417 B
C++
|
|
#include <Stepper.h>
|
|
|
|
const int stepsPerRevolution = 1000; // change this to fit the number of steps per revolution
|
|
// for your motor
|
|
|
|
|
|
// initialize the stepper library on pins 8 through 11:
|
|
Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
|
|
|
|
int stepCount = 0; // number of steps the motor has taken
|
|
|
|
void setup() {
|
|
// nothing to do inside the setup
|
|
}
|
|
|
|
void loop() {
|
|
myStepper.step(analogRead(A0)*10);
|
|
}
|