The MBED firmware used on the Chipin sorter, developed over 12 weeks for a 3rd year university systems project. Chipin is a token sorter, it sorts tokens by colours and dispenses them to order through an online booking system and card reader. This program interfaces with an FPGA, PC and LCD screen to control the sorter. The sorter has an operation mode where it can process orders when a card is entered into the machine. There is also a maintenance mode where the device responds to maintenance instructions such as 'dispense all'. More information at http://www.ionsystems.uk/

Dependencies:   MCP23017 TCS3472_I2C WattBob_TextLCD mbed-rtos mbed

Revision:
11:06f6e82b40a8
Parent:
6:e64796f1f384
Child:
13:0661d658d9d1
diff -r 8c0696b99692 -r 06f6e82b40a8 colourProcessing.h
--- a/colourProcessing.h	Wed Nov 12 20:14:45 2014 +0000
+++ b/colourProcessing.h	Thu Nov 13 11:59:39 2014 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "TCS3472_I2C.h"
 #include "Colour.h"
+
 TCS3472_I2C rgb_sensor(p28,p27); //p28 =sda, p27=scl
 
 int rgb_readings[4];
@@ -9,12 +10,21 @@
 double bMax = 3590;
 
 //thresholds are in the RGB format.
+/*
+Values for black casing
 int redLT [3] = {79,23,41};
 int redUT [3]= {92,28,49};
 int greenLT [3] = {46,81,61};
 int greenUT [3]= {60,107,81};
 int blueLT [3]= {25,47,47};
-int blueUT [3]= {28,52,52};
+int blueUT [3]= {28,52,52};*/
+//values for blue backing
+int redLT [3] =     {211,0,0};
+int redUT [3]=      {400,140,200};
+int greenLT [3] =   {141,251,211};
+int greenUT [3]=    {210,400,400};
+int blueLT [3]=     {0,141,150};
+int blueUT [3]=     {140,250,210};
 
 void initColourSensor(){
     rgb_sensor.enablePowerAndRGBC();
@@ -31,13 +41,13 @@
         int red = redd;
         int green = greend;
         int blue = blued;  
-        colourDataAcquired = true;
+        //colourDataAcquired = true;
         lcd->cls(); // clear display 
         lcd->locate(0,0); 
-        lcd->printf("R:%d G:%d B:%d",red,green,blue);
+        lcd->printf("R:%dG:%dB:%d",red,green,blue);
         
         lcd->locate(1,0); 
-        if(red > 55){
+        /*if(red > 55){
             lcd->printf("RED");
         }
         if(green > 55){
@@ -45,7 +55,7 @@
         } 
         if(red < 30 && green > 30 && blue > 30){
             lcd->printf("BLUE");
-        }  
+        }*/  
         
         bool redWithinThreshold[3] = {0,0,0};
         bool greenWithinThreshold[3]= {0,0,0};
@@ -77,7 +87,7 @@
             }
         else{
             lcd->printf("BIN");
-            colour = OTHER;
+            colour = BIN;
             }    
         return colour;
 }
@@ -91,7 +101,7 @@
         break;
         case BLUE:
         break;
-        case OTHER:
+        case BIN:
         break;
         }
     }
\ No newline at end of file