#include <SPI.h>
#include <Ethernet.h>
#include <RFID.h>
#include <LiquidCrystal.h>
#define SDA_DIO 6 //rfid connection of spı
#define RESET_DIO 7 //rfid connection of spı
#define No_Of_Card 21 //total number of cards
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //Setting MAC Address
char server[] = "192.168.0.103";
IPAddress ip(192,168,0,103);
EthernetClient client;
LiquidCrystal lcd(A0, A1, A2,A3, A4,A5);
RFID RC522(SDA_DIO, RESET_DIO); //rfid connection of spı
int buzzer = 5;
int led_green = 48;
int led_red = 49;
String card = "";
void redLED();
void greenLED();
void lowLEDS();
void Sending_To_phpmyadmindatabase();
int allowed_member=0; //defined card variable
int x=0;
//defined card ids
char *myStrings[No_Of_Card+1] = {"62001a",
"59c4a28b",
"d4685b9",
"c6fda21a",
"d63421a",
"8b57c69",
"c414ee49",};
void setup() {
Serial.begin(9600);
pinMode(led_green, OUTPUT);
pinMode(led_red, OUTPUT);
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
digitalWrite(led_red, HIGH);
Ethernet.begin(mac, ip);
}
else
lowLEDS();
Serial.println(server);
delay(1000);
lcd.begin(16, 2);
lcd.clear();
lcd.print("Ready...");
SPI.begin(); // run SPI library first; if not, RFID will not work
RC522.init();
tone(buzzer, 1200, 100);
delay(170);
tone(buzzer, 1200, 100);
delay(170);
tone(buzzer, 1200, 100);
delay(170);
tone(buzzer, 1200, 100);
delay(750);
}
void loop(){
lcd.noDisplay();
lcd.display(); // Turn on the display:
lcd.begin(16, 2);
lcd.print("Ready...");
if (RC522.isCard())
{
card = "";
RC522.readCardSerial();
Serial.print("Card detected: ");
for(int i=0;i<4;i++)
{
card += String(RC522.serNum[i],HEX);
}
Serial.print(card);
Serial.println();
for(x=0;x<No_Of_Card;x++){
Serial.println(myStrings[x]);
if(card==myStrings[x]){
Serial.println("buldu");
Serial.println(myStrings[x]);
allowed_member=1;
greenLED();
}
}
if(allowed_member!=1){
allowed_member=0;
redLED();
}
Sending_To_phpmyadmindatabase();
delay(300); // interval
}
}
//send of datas
void Sending_To_phpmyadmindatabase()
{
if (client.connect(server, 80)) {
Serial.println("connected");
Serial.print("GET /code/rfid.php?card=");
client.print("GET /code/rfid.php?card=");
Serial.println(card);
client.print(card);
client.print("&allowed_member=");
Serial.println("&allowed_member=");
Serial.println(allowed_member);
client.print(allowed_member);
client.print(" "); //SPACE BEFORE HTTP/1.1
client.print("HTTP/1.1");
client.println();
client.println("Host: 192.168.0.103");
client.println("Connection: close");
client.println();
} else {
// if you didn't get a connection to the server:
Serial.println("connection failed");
}
delay(1000);
digitalWrite(led_green, LOW);
digitalWrite(led_red, LOW);
allowed_member=2;
}
void redLED(){
lcd.clear();
lcd.print("Error!");
digitalWrite(led_red, HIGH);
delay(200);
tone(buzzer, 1200, 80);
lcd.clear();
}
void greenLED(){
lcd.clear();
lcd.print("ok!");
digitalWrite(led_green, HIGH);
delay(200);
tone(buzzer, 300, 80);
lcd.clear();
}
void lowLEDS(){
digitalWrite(led_red, LOW);
digitalWrite(led_green, LOW);
}
C:\Users\hp\Downloads\extramus\access-20220204T104739Z-001\access\access_rfid\access_rfid.ino:43:10: fatal error: RFID.h: No such file or directory
#include <RFID.h>
^~~~~~~~
compilation terminated.
Compilation error: exit status 1}