Shivanand Gowda
/
RFID125KHz
RFID125Khz NuleoF767ZI RFID
main.cpp
- Committer:
- shivanandgowdakr
- Date:
- 2018-07-12
- Revision:
- 0:fe7bca56775a
File content as of revision 0:fe7bca56775a:
#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); } }