Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
Hi, I'm fairly new to both MBED and programming in general. My current project is to read a rfid card and if it matches the card in the program then activate a relay, the relay code is written, where I'm having problems is with getting the mbed to correctly read the RFID tag. currently it detects the tag and prints detected rfid...| on the terminal, but never sends the tag, here is my code. Any help would be appreciated.
#include "mbed.h" DigitalOut led(LED1); //indicates the enabled state on the board as well as the reciver DigitalOut enable(p20); //enables the reader when 0 Serial rfid(p28, p27); //tx, rx Serial pc(USBTX, USBRX); //For pc comunication void * cpoin; //pointer to 'code' char code[100]; //string to hold the alphanumeric RFID code int main() { cpoin = &code; rfid.baud(2400);//RFID reader operates at 2400 baud enable = 0; led = 0; while (1) { if (rfid.readable()) { rfid.scanf("%s", cpoin); pc.printf("detected rfid...| \n"); pc.printf("rfid code is:", code); enable = 1; led = 1; wait(15); enable = 0; led = 0; } } }