Program for controlling stepper motors with threads.

Dependencies:   mbed-rtos mbed

Fork of MotorControl by Markus Haugsdal

Files at this revision

API Documentation at this revision

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
--- 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();