![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Program for controlling stepper motors with threads.
Fork of MotorControl by
Revision 2:25bcc26f7a5b, committed 2016-04-07
- Comitter:
- rlanghbv
- Date:
- Thu Apr 07 11:05:26 2016 +0000
- Parent:
- 1:a3287196a9b3
- Commit message:
- Using Serial instead of STDIN
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a3287196a9b3 -r 25bcc26f7a5b main.cpp --- a/main.cpp Thu Apr 07 10:51:36 2016 +0000 +++ b/main.cpp Thu Apr 07 11:05:26 2016 +0000 @@ -1,6 +1,7 @@ #include "mbed.h" #include "rtos.h" +Serial pc(USBTX, USBRX); // tx, rx //Analog Pins DigitalOut IN1(D3); @@ -69,14 +70,19 @@ { while(true) { - scanf(" %c", &global_direction); + //scanf(" %c", &global_direction); + //global_direction=getchar(); + if(pc.readable()) + { global_direction=pc.getc(); } + + Thread::wait(10); } } int main() { //Thread 1 has constant feed from usb - //Thread t1(input); + Thread t1(input); while (true) { step4Left();