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

cardReader.h

Committer:
IonSystems
Date:
2014-11-20
Revision:
13:0661d658d9d1
Parent:
12:814a8fdbb6f7
Child:
23:f9e7e64784be

File content as of revision 13:0661d658d9d1:

#include "mbed.h"

DigitalIn cardBit1(p21);
DigitalIn cardBit2(p22);
DigitalIn cardBit3(p23);
DigitalIn cardBit4(p24);
DigitalIn cardBit5(p25);
DigitalIn cardBit6(p26);
DigitalIn cardDetect(p29);


int cardValues[6] = {0,0,0,0,0,0};

bool cardDataAcquired = false;

void cardAcquisition(){
        lcd->reset();
        lcd->locate(0,0);   //Going to new line
        if(cardBit1) lcd->printf("p1=1,");
        else lcd->printf("p1=0,");
        cardValues[0] = cardBit1;
        
        if(cardBit2) lcd->printf("p2=1,");
        else lcd->printf("p2=0,");
        cardValues[1] = cardBit2;
        
        if(cardBit3) lcd->printf("p3=1");
        else lcd->printf("p3=0");
        cardValues[2] = cardBit3;
        
        lcd->locate(1,0);   //Going to new line
        
        if(cardBit4) lcd->printf("p4=1");
        else lcd->printf("p4=0,");
        cardValues[3] = cardBit4;
        
        
        if(cardBit5) lcd->printf("p5=1,");
        else lcd->printf("p5=0,");
        cardValues[4] = cardBit5;
        
        if(cardBit6) lcd->printf("p6=1");
        else lcd->printf("p6=0");
        cardValues[5] = cardBit6;
        
        //cardDataAcquired = true;
        
    }