Karl Nicolaus
/
6408_StepperTest2
upload 1
Revision 1:1b53b0709422, committed 2019-03-06
- Comitter:
- kanicolaus
- Date:
- Wed Mar 06 23:16:04 2019 +0000
- Parent:
- 0:52fb09e87581
- Commit message:
- test
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 Wed Mar 06 23:16:04 2019 +0000 @@ -0,0 +1,42 @@ +#include "mbed.h" +#include "Stepper.h" + +// Pin setup +DigitalOut step(p22); +DigitalOut dir(p21); +DigitalOut m1(p23); +DigitalOut m0(p24); +DigitalOut step_indicator(LED1); + + +// Microstepping config +// (m1)|(m0)|(mode) +// 0|0|full +// 0|1|1/2 +// 0|Z|1/4 +// 1|0|8 usteps/sec +// 1|1|16 usteps/sec +// 1|Z|32 usteps/sec +int delay = 10; + +int main() +{ + m1 = 0; + m0 = 0; + step = 0; + dir = 1; + step_indicator = 0; + + while(1) { + for (int i=1; i<=200*16; ++i) { + step = 1; + step_indicator = 1; + wait_ms(delay); + step = 0; + step_indicator = 0; + wait_ms(delay); + } + dir = !dir; + wait(1.0); + } +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Wed Mar 06 23:16:04 2019 +0000 @@ -0,0 +1,1 @@ +https://mbed.org/users/mbed_official/code/mbed/builds/64910690c574 \ No newline at end of file