Program for stepper test.
Dependencies: StepperDriver mbed
Revision 2:702fd272a9c8, committed 2016-12-02
- Comitter:
- tbjazic
- Date:
- Fri Dec 02 08:37:14 2016 +0000
- Parent:
- 1:5d11b66aba85
- Commit message:
- A lots of functions added, together with their docs. We need to verify this code before moving to speed profile settings.
Changed in this revision
StepperDriver.lib | Show annotated file Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5d11b66aba85 -r 702fd272a9c8 StepperDriver.lib --- a/StepperDriver.lib Thu Dec 01 14:19:31 2016 +0000 +++ b/StepperDriver.lib Fri Dec 02 08:37:14 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/TVZ-Mechatronics-Team/code/StepperDriver/#12be56dc6182 +https://developer.mbed.org/teams/TVZ-Mechatronics-Team/code/StepperDriver/#9888802e71b9
diff -r 5d11b66aba85 -r 702fd272a9c8 main.cpp --- 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