Program for stepper test.
Dependencies: StepperDriver mbed
Diff: main.cpp
- Revision:
- 2:702fd272a9c8
- Parent:
- 1:5d11b66aba85
--- a/main.cpp Thu Dec 01 14:19:31 2016 +0000 +++ b/main.cpp Fri Dec 02 08:37:14 2016 +0000 @@ -8,7 +8,7 @@ DigitalOut CDRESETn(p15); DigitalOut DECAY(p18); -float t = 0; +float t = 0, period = 2; int main() { @@ -18,11 +18,13 @@ CDRESETn = 1; //Logicka 0 ukljucuje indekser ali gasi H-most DECAY = 0; //Logicka 0 slow decay, 1 za mixed decay - stepper.setPosition(322); + stepper.setPosition(720); wait(2); - while(true) { - stepper.setPosition(322+175*sin(2*3.14159*1*t)); + while(t < 10*period) { + stepper.setPosition(720+360*sin(2*3.14159f/period*t)); t += 0.05; wait(0.05); } + stepper.setPosition(0); + CDENBLN = 1; } \ No newline at end of file