![](/media/cache/profiles/a8849b052492b5106526b2331e526138.50x50_q85.jpg)
Diff: main.cpp
- Revision:
- 0:4b1075fe566a
--- /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