RFID-RC522 LCD 16x2 A1602
Dependencies: mbed MFRC522 TextLCD
Diff: main.cpp
- Revision:
- 6:edbad35965d6
- Parent:
- 5:6d60fc8516d1
- Child:
- 7:1e3fedf9f001
--- a/main.cpp Sat May 09 16:42:02 2020 +0000 +++ b/main.cpp Sun May 10 09:53:34 2020 +0000 @@ -46,6 +46,8 @@ #endif +#include <string> + DigitalOut LedRed (LED_RED); DigitalOut LedGreen (LED_GREEN); @@ -73,8 +75,13 @@ * On success the PICC is halted after dumping the data. * For MIFARE Classic the factory default key of 0xFFFFFFFFFFFF is tried. */ + //INITIAL TIME time_t seconds = time(NULL); + + +bool usuario1= true; + void DumpToSerial(MFRC522::Uid *uid) { MFRC522::MIFARE_Key key; @@ -85,24 +92,46 @@ //Pablo Muñoz Coronas - 1358297 // UID - printf("Tarjeta Detectada! Card UID\n\r"); - lcd.printf("Card UID:"); + printf("Tarjeta Detectada! Card UID\n\r"); + + + lcd.printf("Card UID:"); + + + //SIZE 4-4-4-4 16 BITS (HEXADECIMAL) + for (uint8_t i = 0; i < uid->size; i++) { - - printf(" %X02", uid->uidByte[i]); + + printf(" %X02", uid->uidByte[i]); lcd.printf(" %X02", uid->uidByte[i]); } printf("\n\r"); - printf("\n\r"); + wait_ms(1000);// 200 + + + lcd.cls(); - + lcd.locate(0,0); + lcd.printf("Time is: %s %s\n",__TIME__,__DATE__); //TIEMPO DE COMPILACION + + wait_ms(1000);// 200 + lcd.cls(); + lcd.locate(0,0); + + if(usuario1){ + lcd.printf("Entrada usuario: Cristian Vega"); + usuario1=false; + }else{ + lcd.printf("Salida usuario: Cristian Vega"); + usuario1=true; + + } + + char buffer[32]; strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds)); - printf(" %s", buffer); - - // PICC type uint8_t piccType = RfChip.PICC_GetType(uid->sak); //printf("PICC Type: %s \n\r", RfChip.PICC_GetTypeName(piccType));