matt gring
/
StepperDriverTest
Revision 0:4b1075fe566a, committed 2009-11-22
- Comitter:
- user153739798366067129
- Date:
- Sun Nov 22 05:10:47 2009 +0000
- Commit message:
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 |
diff -r 000000000000 -r 4b1075fe566a main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Nov 22 05:10:47 2009 +0000 @@ -0,0 +1,47 @@ +// Stepper driver test- this program uses the mbed to drive a STK672-330 ic with an attached stepper. + + +#include "mbed.h" + +// set pin outputs +DigitalOut enable(5); +DigitalOut direction(6); +DigitalOut clk(7); + +int i = 0; + +int main() { + +// turn on driver ic + enable = 1; + + while(1) { + + direction = 1; // go one way for a bit + i = 0; + while (i != 5000) { + + clk = 1; + wait_us(500); + clk = 0; + wait_us(500); + + i += 1; + } + + i = 0; + direction = 0; // now go the other way + + while (i != 5000) { + + clk = 1; + wait_us(500); + clk = 0; + wait_us(500); + + i += 1; + } + + } + + } \ No newline at end of file
diff -r 000000000000 -r 4b1075fe566a mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Nov 22 05:10:47 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fcb9359f0959