Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 // Stepper driver test- this program uses the mbed to drive a STK672-330 ic with an attached stepper. 00002 00003 00004 #include "mbed.h" 00005 00006 // set pin outputs 00007 DigitalOut enable(5); 00008 DigitalOut direction(6); 00009 DigitalOut clk(7); 00010 00011 int i = 0; 00012 00013 int main() { 00014 00015 // turn on driver ic 00016 enable = 1; 00017 00018 while(1) { 00019 00020 direction = 1; // go one way for a bit 00021 i = 0; 00022 while (i != 5000) { 00023 00024 clk = 1; 00025 wait_us(500); 00026 clk = 0; 00027 wait_us(500); 00028 00029 i += 1; 00030 } 00031 00032 i = 0; 00033 direction = 0; // now go the other way 00034 00035 while (i != 5000) { 00036 00037 clk = 1; 00038 wait_us(500); 00039 clk = 0; 00040 wait_us(500); 00041 00042 i += 1; 00043 } 00044 00045 } 00046 00047 }
Generated on Thu Jul 14 2022 16:22:21 by
1.7.2