Rune sitt program
Dependencies: mbed
Fork of L298N_Stepper_4wire_example by
Revision 0:bd78e433db61, committed 2016-02-29
- Comitter:
- rlanghbv
- Date:
- Mon Feb 29 12:10:54 2016 +0000
- Commit message:
- Firtst Commit
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Feb 29 12:10:54 2016 +0000 @@ -0,0 +1,75 @@ +#include "mbed.h" + + +DigitalOut IN1(D3); +DigitalOut IN2(D4); + +DigitalOut IN3(D5); +DigitalOut IN4(D6); + + +DigitalIn SW(USER_BUTTON); + +void step4Right() +{ + IN1=0; + IN2=1; + IN3=0; + IN4=1; + wait_us(1000); + IN1=0; + IN2=1; + IN3=1; + IN4=0; + wait_us(1000); + IN1=1; + IN2=0; + IN3=1; + IN4=0; + wait_us(1000); + IN1=1; + IN2=0; + IN3=0; + IN4=1; + wait_us(1000); +} + + +void step4Left() +{ + IN1=1; + IN2=0; + IN3=0; + IN4=1; + wait_us(1000); + + IN1=1; + IN2=0; + IN3=1; + IN4=0; + wait_us(1000); + + IN1=0; + IN2=1; + IN3=1; + IN4=0; + wait_us(1000); + + IN1=0; + IN2=1; + IN3=0; + IN4=1; + wait_us(1000); +} + + +int main() +{ + while (true) { + if(SW==1) + step4Left(); + else + step4Right(); + + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Feb 29 12:10:54 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/252557024ec3 \ No newline at end of file