First Commit

Dependencies:   mbed Crypto_light mbed-rtos

Spin it 2 win it

Revision:
21:0d1025dc6433
Parent:
20:a435105305fe
Child:
22:7c94575d7792
--- a/main.cpp	Tue Mar 20 16:51:38 2018 +0000
+++ b/main.cpp	Tue Mar 20 17:20:13 2018 +0000
@@ -93,7 +93,7 @@
     outMessages.put(pMessage);
 }
 
-Thread commOutT (osPriorityNormal, 512);
+Thread commOutT (osPriorityNormal, 1024);
 
 void commOutFn() {
     while(1) {
@@ -143,24 +143,25 @@
     motorCtrlT.signal_set(0x1);
 }
 
-float currentSpeed = 0;
+volatile float currentSpeed = 0;
 
 
 void motorCtrlFn(){
-    int32_t posStart, posEnd;
+    int32_t posStart = 0, posEnd = 0;
     Ticker motorCtrlTicker;
     motorCtrlTicker.attach_us(&motorCtrlTick,100000);
-    // putMessage(MSG_TEST, 0x505);
+    putMessage(MSG_TEST, 0x505);
     uint8_t cnt = 0;
 
     while(1){
         posStart = motorPosition;
         motorCtrlT.signal_wait(0x1);
         posEnd = motorPosition;
-        currentSpeed = (posEnd-posStart)*10;
+        currentSpeed = (posEnd - posStart)*10;
 
         if(cnt >= 9) {
-            // putMessage(MSG_CUR_SPD, currentSpeed);
+            putMessage(MSG_CUR_SPD, currentSpeed);
+            // putMessage(MSG_TEST, posEnd);
             cnt = 0;
         }
         else{ cnt++; }