3rd year group project. Electronic and Electrical Engineering. Heriot-Watt University. This is the code for the mbed for the Automatic Little Object Organiser (ALOO).

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed

Revision:
10:16ba52f8e025
Parent:
9:dc8f155b71c8
Child:
12:f485796016f8
--- a/commander.cpp	Mon Nov 16 23:44:44 2015 +0000
+++ b/commander.cpp	Wed Nov 18 16:09:52 2015 +0000
@@ -15,7 +15,7 @@
 string CommandObjectCommandsValue [5][kMaxCommandCount] = {
 	{"mbed", "haz-block", "read-current-block", "", "", "", "", "", "", ""},
 	{"pc", "connect", "disconnect", "", "", "", "", "", "", "exit"},
-	{"colour_sensor", "i-time=", "preview=", "", "", "", "", "", "", ""},
+	{"colour_sensor", "i-time=", "preview=", "read", "", "", "", "", "", ""},
 	{"servos", "test", "reset", "", "", "", "", "", "", ""},
 	{"port", "init", "b-rate=", "parity=", "stopbit=", "", "", "", "", ""},
 };
@@ -41,10 +41,9 @@
 	
 	this->readCommand(this->objectRaw);
 	if (this->commandValueIndex == -1) { return; }
-	else if ((connectedToPC == false) && (this->typeRaw != Set || this->objectRaw != PC || this->commandValueIndex != 1)) { return; }
-	
-	this->executeCommand();
-	return;
+//	else if ((connectedToPC == false) && (this->typeRaw != Set || this->objectRaw != PC || this->commandValueIndex != 1)) { return; }
+	else if (connectedToPC == true || (this->typeRaw == Set && this->objectRaw == PC && this->commandValueIndex == 1)) { this->executeCommand(); }
+	else { return; }
 }
 
 std::string Commander::description(){
@@ -162,6 +161,8 @@
 				}else if (this->commandValue == "OFF"){
 					previewOnPC(false);
 				}
+			}else if (this->commandValueIndex == 3){
+				readColourSensor();
 			}
 			break;
 		case Servos: