/********* Pleasedontcode.com **********
Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- Terms and Conditions:
You have a non-exclusive, revocable, worldwide, royalty-free license
for personal and commercial use. Attribution is optional; modifications
are allowed, but you're responsible for code maintenance. We're not
liable for any loss or damage. For full terms,
please visit pleasedontcode.com/termsandconditions.
- Project: RFID Reader
- Source Code NOT compiled for: ESP32 DevKit V1
- Source Code created on: 2024-05-09 10:54:01
********* Pleasedontcode.com **********/
/****** SYSTEM REQUIREMENTS *****/
/****** SYSTEM REQUIREMENT 1 *****/
/* RC522 scan cards */
/****** END SYSTEM REQUIREMENTS *****/
/****** DEFINITION OF LIBRARIES *****/
#include
#include // Include the MFRC522 library
/****** FUNCTION PROTOTYPES *****/
void setup(void);
void loop(void);
/***** DEFINITION OF I2C PINS *****/
const uint8_t Sceen_LCD1602I2C_I2C_PIN_SDA_D21 = 21;
const uint8_t Sceen_LCD1602I2C_I2C_PIN_SCL_D22 = 22;
const uint8_t Sceen_LCD1602I2C_I2C_SLAVE_ADDRESS = 39;
// Create an instance of the MFRC522 library
MFRC522 mfrc522(/*SS pin*/ 5, /*RST pin*/ 4); // Change the SS and RST pins as per your wiring
void setup(void)
{
// put your setup code here, to run once:
Serial.begin(9600);
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522 card
Serial.println("Scan RFID card to get the UID...");
}
void loop(void)
{
// put your main code here, to run repeatedly:
// Look for new cards
if (mfrc522.PICC_IsNewCardPresent() && mfrc522.PICC_ReadCardSerial())
{
// Show UID on serial monitor
Serial.print("UID tag :");
String content = "";
for (byte i = 0; i < mfrc522.uid.size; i++)
{
content.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte[i], HEX));
}
content.toUpperCase();
Serial.println(content);
}
}
/* END CODE */