hi.
this is my first topic.
i want to make a "rfid door system".
something i have done.
When I run the system, the system is running at startup.
but after a few minutes, the system is not reading the cards.
++
The interesting thing is that if I open the serial screen, the system is triggered and started working.
to solve problem,
i changed arduino, lcd, rfid rc5522..
but all time the same problem.
I took the role.but the same problem.
#include <LiquidCrystal_I2C.h>
//#include <LiquidCrystal_I2C_AvrI2C.h>
#include <SPI.h>
#include <MFRC522.h>
constexpr uint8_t RST_PIN = 9;
constexpr uint8_t SS_PIN = 10;
LiquidCrystal_I2C lcd(0x27, 16, 2); //Parameters: (rs, enable, d4, d5, d6, d7)
//LiquidCrystal_I2C_AvrI2C lcd(0x27,16,2); // 16 karakter 2 satır için - 20x4 satır için (0x27,20,4) yazın
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
int buzzerPin = 8;
int relayPin = 2;
void setup() {
pinMode(buzzerPin, OUTPUT);
pinMode(relayPin, OUTPUT);
digitalWrite(relayPin, LOW);
lcd.begin(); // LCD screen
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
lcd.setCursor(0, 0);
lcd.print("RFID KAPI Kilidi");
lcd.setCursor(0, 1);
lcd.print(" by ATAMAN");
delay(3000);
lcd.clear();
}
void loop() {
lcd.setCursor(0, 0);
lcd.print("RFID KAPI Kilidi");
lcd.setCursor(0, 1);
lcd.print(" KARTINI OKUT ");
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
//Reading from the card
String tag = "";
for (byte i = 0; i < mfrc522.uid.size; i++)
{
tag.concat(String(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " "));
tag.concat(String(mfrc522.uid.uidByte[i], HEX));
}
tag.toUpperCase();
//Checking the card
if (tag.substring(1) == "1A A6 74 63") //change here the UID of the card/cards that you want to give access
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("ERISIM IZNI VERILDI");
lcd.setCursor(0, 1);
lcd.print(" KAPI ACILDI");
digitalWrite(relayPin, HIGH);
delay(3000);
digitalWrite(relayPin, LOW);
lcd.clear();
}
else
{
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" YETKISIZ KART");
lcd.setCursor(0, 1);
lcd.print("Erisim Izni Yok");
digitalWrite(buzzerPin, HIGH);
delay(3000);
digitalWrite(buzzerPin, LOW);
lcd.clear();
}
}
thanks.