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:
25:792540d69c49
Parent:
24:02c61793f90b
Child:
26:bbcc25418ffa
--- a/globals.cpp	Sun Nov 29 01:05:42 2015 +0000
+++ b/globals.cpp	Mon Nov 30 15:06:38 2015 +0000
@@ -10,13 +10,17 @@
 int ColourSensorError = 0.5;
 //SerialBase gParity = SerialBase::None;
 int gStopBits = 1;
-
+float gIntegrationTime = 3;
+int gToggleServoNumber = 0;
 
 Block _HazBlock = Block();
 
 bool connectedToPC = false;
 bool runServoTest = false;
 bool runBreakBeamTest = false;
+bool runColourSensorTest = false;
+bool getColourSensorValue = false;
+bool getBlockColourValue = false;
 PCModes currentMode = None;
 Controls currentState = Pause;
 
@@ -140,8 +144,9 @@
 
 void setIntegrationTimeTo(float integrationTime)
 {
-    rgbSensor.setIntegrationTime(integrationTime);
-    pc.printf("DEBUG: Setting integration-time to %i.\n", integrationTime);
+    gIntegrationTime = integrationTime;
+    rgbSensor.setIntegrationTime(gIntegrationTime);
+    pc.printf("DEBUG: Setting integration-time to %i.\n", gIntegrationTime);
 }
 
 void previewOnPC(bool on)
@@ -149,6 +154,16 @@
     pc.printf("setting preview on pc to %i.\n", on);
 }
 
+void testColourSensor(Controls state){
+	if (state == Start){
+		pc.printf("INFO: Running colour test.\n");
+		runColourSensorTest = true;
+	} else if (state == Pause){
+		pc.printf("INFO: Finished colour test.\n");
+		runColourSensorTest = false;
+	}
+}
+
 void readColourSensor()
 {
     int colourValue[4];