![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
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
Diff: main.cpp
- Revision:
- 7:6ba00694f9cd
- Parent:
- 6:e64796f1f384
- Child:
- 8:b7771391adc9
diff -r e64796f1f384 -r 6ba00694f9cd main.cpp --- a/main.cpp Fri Nov 07 20:16:23 2014 +0000 +++ b/main.cpp Mon Nov 10 15:03:20 2014 +0000 @@ -4,10 +4,13 @@ #include "mbedStorage.h" #include "rgbLED.h" #include "mbedLCD.h" +#include "stateMachine.h" Serial pc(USBTX, USBRX); +StateMachine stateMachine; + //Boolean values to easily enable and disable certain features for individual testing bool colourSensor = true; @@ -23,17 +26,17 @@ int main() { -writeFile(2,6,22); -readChipNumbers(); -setupLCD(); -printLCD("Welcome to the Chipin Sorter"); -wait(1); -printStoredChipValues(); + stateMachine = INITIALISING; + writeFile(2,6,22); + readChipNumbers(); + setupLCD(); + printLCD("Welcome to the Chipin Sorter"); + wait(1); + printStoredChipValues(); /* while(1){ if(par_port->read_bit(11)) resetForNextCustomer(); - // char c = pc.getc(); //wait for a serial character to be recieved. - // processMessage(c); //Do something, based on the character recieved. + if(cardDetect & !cardDataAcquired) cardAcquisition(); setLEDs(); readButtons();