![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Stepper motor
Dependencies: StepperMotorUni mbed
Diff: main.cpp
- Revision:
- 0:1f4ed94b7b01
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Oct 08 16:15:32 2015 +0000 @@ -0,0 +1,47 @@ +#include "mbed.h" + + +BusOut steps (PA_7, PB_6, PC_7, PA_9); + + +int main() +{ + int i=0; + int svar; + + printf("Tast 0 for med klokka, tast 1 for mot klokka\n"); + scanf("%d",&svar); + + if(svar==0) + { + for (i=0;i<512;i++) + { + steps=0x9; + wait_ms(5); + steps=0xC; + wait_ms(5); + steps=0x6; + wait_ms(5); + steps=0x3; + wait_ms(5); + } + } + + else if(svar==1) + { + for (i=0;i<512;i++) + { + steps=0x3; + wait_ms(5); + steps=0x6; + wait_ms(5); + steps=0xC; + wait_ms(5); + steps=0x9; + wait_ms(5); + } + } + } + + +