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

Committer:
IonSystems
Date:
Fri Nov 07 20:16:23 2014 +0000
Revision:
6:e64796f1f384
Child:
10:8c0696b99692
Recovered from the attack of Euan

Who changed what in which revision?

UserRevisionLine numberNew contents of line
IonSystems 6:e64796f1f384 1 #include "mbed.h"
IonSystems 6:e64796f1f384 2 LocalFileSystem local("local");
IonSystems 6:e64796f1f384 3 void writeFile(int r, int g, int b){
IonSystems 6:e64796f1f384 4 FILE* File1 = fopen("/local/datafile.txt","w"); // open file
IonSystems 6:e64796f1f384 5 fputc(r, File1); // put char (data value) into file
IonSystems 6:e64796f1f384 6 fputc(g, File1); // put char (data value) into file
IonSystems 6:e64796f1f384 7 fputc(b, File1); // put char (data value) into file
IonSystems 6:e64796f1f384 8 fclose(File1); // close file
IonSystems 6:e64796f1f384 9 }
IonSystems 6:e64796f1f384 10
IonSystems 6:e64796f1f384 11 int readFile(int index){
IonSystems 6:e64796f1f384 12 FILE* File2 = fopen ("/local/datafile.txt","r"); // open file for reading
IonSystems 6:e64796f1f384 13 int read_var;
IonSystems 6:e64796f1f384 14 for(int i = 0; i <= index; i++){
IonSystems 6:e64796f1f384 15 read_var = fgetc(File2); // read data value
IonSystems 6:e64796f1f384 16 }
IonSystems 6:e64796f1f384 17 fclose(File2); // close file
IonSystems 6:e64796f1f384 18 return read_var;
IonSystems 6:e64796f1f384 19 }