v1.1

Dependencies:   mbed QEI

Revision:
3:054df6da48b5
Parent:
2:eb82f5cb5098
Child:
4:4b28e4aa1742
--- a/main.cpp	Sun May 05 16:06:29 2019 +0000
+++ b/main.cpp	Sun May 05 17:01:42 2019 +0000
@@ -8,7 +8,7 @@
 BusIn button_bus{D7, D9};
 DigitalIn a(D7),b(D9),c(D3),d(D4),e(D5),f(D6); //Dummy pin for pulling
 
-char data[8];
+int data[8];
 
 void init_();
 
@@ -23,18 +23,30 @@
         else if (pulse <= 0)
             pulse = 0; 
         data[0] = 0x77;
-        data[1] = (char)button_bus.read();
-        data[2] = (char)joy_bus.read();
+        data[1] = button_bus.read();
+        data[2] = joy_bus.read();
         if (pulse > 255){
-            data[3] = (char)pulse-255;
-            data[4] = (char)255;
+            data[3] = pulse-255;
+            data[4] = 255;
         }else{ 
-            data[3] = (char)0;
-            data[4] = (char)pulse;
+            data[3] = 0;
+            data[4] = pulse;
         } 
         data[5] = 0x00;
         data[6] = 0x00;
         data[7] = 0x0A;
+        
+        //Data overwrite for serial transmit debug
+       /* data[0]= 0x00;
+        data[1]= 0x01;
+        data[2]= 0x02;
+        data[3]= 0x03;
+        data[4]= 0x04;
+        data[5]= 0x05;
+        data[6]= 0x06;
+        data[0]= 0x00;
+        */
+        
         for (int i = 0; i<=7; i++)
             pc.putc(data[i]);
     }