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:
22:8f11d1c178ab
Parent:
21:3d9556f5508a
Child:
23:f9e7e64784be
--- a/serialCommunication.h	Tue Nov 25 13:48:23 2014 +0000
+++ b/serialCommunication.h	Tue Nov 25 22:32:26 2014 +0000
@@ -26,6 +26,12 @@
 void sendCardValues(){
     pc.putc('R');//start bit
     //data
+    pc.putc(cardValues[0]);
+    pc.putc(cardValues[1]);
+    pc.putc(cardValues[2]);
+    pc.putc(cardValues[3]);
+    pc.putc(cardValues[4]);
+    pc.putc(cardValues[5]);
     pc.putc('C');//stop bit
     }
 
@@ -103,15 +109,9 @@
             break;
             }
             {
-            case 'd':   //Dispense a chip
+            case 'd':   //Sort Bin
+                sort(BIN);
                 sendCharacter('D');
-                printLCD("Dispensing chip");
-              
-                //read from color sensor
-                //convert readings to colour
-                //convert colour to 3-bit colour code
-                //set the FPGA colour inputs to the colour code
-                startSort = true; 
             break;
             }
             {
@@ -162,7 +162,7 @@
             }
             {
             case 'w':
-                maintain(BR_LEFT);
+                maintain(BR_RIGHT);
                 sendCharacter('O');
             break;
             }
@@ -204,6 +204,12 @@
             sendCharacter('5');
             break;   
             }
+            {
+            case 'e':
+            recycle();
+            sendCharacter('E');
+            break;
+            }