Shivanand Gowda
/
RFID125KHz
RFID125Khz NuleoF767ZI RFID
Diff: main.cpp
- Revision:
- 0:fe7bca56775a
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Jul 12 10:11:25 2018 +0000 @@ -0,0 +1,52 @@ +#include "mbed.h" + +DigitalOut led1(LED1); +Serial Rfid125(PC_12,PD_2); +Thread RFID_Thread; + +char TAG_ID[15]={'\0'}; + +void Read_CARD_RFID_125(void) +{ + int i=0; + memset(TAG_ID,'\0',15); + +while(1) +{ + while(Rfid125.readable()) + { + char c=Rfid125.getc(); + if(c=='\n') + return; + + else if(c>='\0' && c<='9' && c>='A' && c<='F') + { + TAG_ID[i]=c; + i++; + } + + else + { + printf("Unable to read the CARD\r\n"); + printf("CARD Corrupted \r\n"); + } + } +} +} + +// main() runs in its own thread in the OS +int main() { + + RFID_Thread.start(Read_CARD_RFID_125); + + while (true) { + led1 = !led1; + wait(0.5); + } +} + + + + + +