Matteus Car
/
motorController2
AccelMotor for Mbed
Diff: main.cpp
- Revision:
- 0:a0391774b0e5
- Child:
- 1:71768fb30886
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 25 18:42:43 2016 +0000 @@ -0,0 +1,33 @@ +/* + sample program for AccelStepper.h + inspired by the Bounce example of the Arduino version + + +*/ +#include "AccelStepper.h" + +/** +*** Main function +**/ + +AccelStepper stepper(4, p21, p22, p23, p24); + +Timer t; + +int main() +{ + t.start(); + stepper.setMaxSpeed(200); + stepper.setAcceleration(50); + stepper.moveTo(500); + stepper.setMinPulseWidth(50); + + + + while (true) { + if (stepper.distanceToGo() == 0) + stepper.moveTo(-stepper.currentPosition()); + stepper.run(); + } +} +