Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed-rtos mbed
cardReader.h
00001 #include "mbed.h" 00002 // Define the card reader input pins. 00003 DigitalIn cardBit1(p21); 00004 DigitalIn cardBit2(p22); 00005 DigitalIn cardBit3(p23); 00006 DigitalIn cardBit4(p24); 00007 DigitalIn cardBit5(p25); 00008 DigitalIn cardBit6(p26); 00009 DigitalIn cardDetect(p29); 00010 00011 /* cardAcquisition() 00012 * Reads the binary values of the card reader inputs and converts them into a decimal number. 00013 * The decimal number is returned as an integer. 00014 */ 00015 00016 int cardAcquisition(){ 00017 //Work out the number of the card 00018 int cardNumber = 0; 00019 //Bit 1 00020 if(cardBit1) cardNumber += 1; 00021 if(cardBit2) cardNumber += 2; 00022 if(cardBit3) cardNumber += 4; 00023 if(cardBit4) cardNumber += 8; 00024 if(cardBit5) cardNumber += 16; 00025 if(cardBit6) cardNumber += 32; 00026 00027 return cardNumber; 00028 }
Generated on Thu Jul 14 2022 19:06:18 by
1.7.2