I recently got an Arduino kit and wanted to make a device with my RC522 RFID Module, UNO R3 board and a LCD1602 Module (with pin header) that if you scan the correct card it displays Access authorized and if incorrect card Access denied. I followed many tutorials, but the LCD doesn't display the messages and shows a row of white boxes in the top row. I read up that it might be something with the pot. Help!
Pictures:
https://docs.google.com/document/d/1DmZTuq3yWdvtdb3pewzz7H4hLt_Q8BMBTY3TSmQDPKg/edit?usp=drivesdk
Code:
</>
#include <SPI.h>
#include <MFRC522.h>
#include <LiquidCrystal.h>
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
Serial.println("Approximate your card to the reader...");
Serial.println();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
// lcd.print("hello, world!");
}
void loop()
{
// lcd.setCursor(0,1);
// lcd.print(millis()/1000);
// Turn off the display:
//lcd.noDisplay();
//delay(500);
// Turn on the display:
lcd.display();
delay(500);
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
lcd.setCursor(0,0);
Serial.print("UID tag :");
lcd.print("UID:");
String content= "";
byte letter;
for (byte i = 0; i < mfrc522.uid.size; i++)
{
Serial.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
_ Serial.print(mfrc522.uid.uidByte*, HEX);_
_ lcd.print(mfrc522.uid.uidByte < 0x10 ? " 0" : " ");
lcd.print(mfrc522.uid.uidByte, HEX);
content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();
Serial.print("Message : ");
lcd.print("Message : ");
content.toUpperCase();
// if (content.substring(1) == "89 31 82 9C") //change here the UID of the card/cards that you want to give access*
* if (content.substring(1) == "89 31 82 9C")
{
lcd.setCursor(0,1);
Serial.println("Authorized access");
Serial.println();
lcd.print("Auth access ");
lcd.println();
delay(3000);
}*_
* else {*
* lcd.setCursor(0,1);*
* Serial.println(" Access denied");*
* lcd.print(" Access denied ");*
* delay(3000);*
* }*
}
</>