Code to run the microcontrollers on the R5 competition bot

Dependencies:   LineSensors mbed

Revision:
7:2f3e841ee0ff
Parent:
6:83c1f8d6a65a
Child:
8:9030d2e3a1e8
--- a/DriveController.cpp	Fri Oct 17 17:54:16 2014 +0000
+++ b/DriveController.cpp	Fri Oct 17 18:55:55 2014 +0000
@@ -167,10 +167,27 @@
 
 void DriveController::getCommand()
 {
+    bool received = false;
+    int status;
+    int msg;
     
+    while(!received)
+    {
+        status = i2c.receive();
+        
+        if(status == 2) //if status is WriteGeneral
+        {
+            msg = i2c.read();
+            received = true;
+        }
+    }
+    
+    command = msg & 252;
+    edge = msg & 243;
+        
 }
 
 void DriveController::sendComplete()
 {
-    
+    i2c.write(1);
 }