Hello this is my first post and i am beginner in mbed we make a project in which there is RFID reader connected to Rx pin p10 of mbed and lcd i want to read string coming from RFID reader and show it on lcd also compair it with switch statement and if string is ok then just say card vaild on lcd we check RFID reader output on pc which string is 2200BE7D7D my code is as follows
- include "mbed.h"
- include "TextLCD.h"
TextLCD lcd(p26, p25, p5, p6, p7, p8); rs, e, d4-d7 define lcd pin
Serial device(p9,p10);tx,rx
char buffer_for_incoming_message[10]; creates buffer for message with max length 30 charac
int main() {
lcd.printf("Hello" );
lcd.locate(0,1);
lcd.printf("Word ");
wait(2);
lcd.cls();;
lcd.printf("Please swap");
lcd.locate(0,1);
lcd.printf("the Card");
device.baud(9600);
wait(1);
lcd.cls();
while(1) {
if (device.readable()){ If pc is readable
device.scanf("%s", &buffer_for_incoming_message); each turn reads message from pc and
lcd.printf(&buffer_for_incoming_message);
switch(&buffer_for_incoming_message)
case 2200BE7D7D:lc.printf("Card is valid);
}
}
}
but it does not work please help me how to write string on lcd and about switch function
Hello this is my first post and i am beginner in mbed we make a project in which there is RFID reader connected to Rx pin p10 of mbed and lcd i want to read string coming from RFID reader and show it on lcd also compair it with switch statement and if string is ok then just say card vaild on lcd we check RFID reader output on pc which string is 2200BE7D7D my code is as follows
int main() { lcd.printf("Hello" ); lcd.locate(0,1); lcd.printf("Word "); wait(2); lcd.cls();; lcd.printf("Please swap"); lcd.locate(0,1); lcd.printf("the Card"); device.baud(9600); wait(1); lcd.cls(); while(1) {
if (device.readable()){ If pc is readable device.scanf("%s", &buffer_for_incoming_message); each turn reads message from pc and lcd.printf(&buffer_for_incoming_message); switch(&buffer_for_incoming_message) case 2200BE7D7D:lc.printf("Card is valid); } } }
but it does not work please help me how to write string on lcd and about switch function