![](/media/cache/profiles/a8849b052492b5106526b2331e526138.50x50_q85.jpg)
main.cpp
- Committer:
- user153739798366067129
- Date:
- 2009-11-22
- Revision:
- 0:4b1075fe566a
File content as of revision 0:4b1075fe566a:
// 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; } } }