RFID

Hey i was making a safe using RFID and a servo motor i wanted the sensor to recognize two tags so that i can use two tags for the same project. Im a beginner so i dont know much Can someone please guide me Thanls!!!

Sofis_Safe.ino (1.69 KB)

Please post your code.
In code tags.
Tell us what problems you're having.

what sort of device reads r f Id tags? sounds like fun

first step is to do an easy calculation:

posting a question in the forum and waiting for an answer usually takes 2-6 hours.

Below I recommend a beginners tutorial. To work through the whole tutorial will need 40-50 hours.
If you have worked through this tutorial 80% of all your questions don't arise anymore because you already know the answers.

So how many questions does it take until you have waited as long as it takes to work through the whole tutorial? 10 to 25 questions.

How many hours would you like to spend per week to program?
let's estimate only 4 hours per week. So it takes four weeks to work through the tutorial.

What do you estimate how long would it take if you don't learn to program and do just

copy & paste
your program still does not exactly what you want.
Aksing a new question
repeat

no idea? I tell you (3 to infinity months)

so next step is
Take a look into this tutorial:

Arduino Programming Course

It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.

I'm a somehow advanced programmer and this has the effect of beeing partially blind about beginners difficulties. But I would like to become an "expert" about beginners difficulties and therefore I appreciate feedback about that and to receive questions what is still hard to understand.

of course you can ask questions in parallel. I'm 100% sure that you can ask a concrete question.
Just use the following method:

start reading the lines in the attched sketch. Whenever you don't understand one of the words you can ask
"What does the "......." do in this line?

example your attached code starts with

#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>

So you can ask the concrete question:
"What does the word "#include" in this program?

Answer is
look up the Arduino-Reference to read (instead of jsut waiting) for an answer in the forum
and there you will find a link
include

first three lines of code explained

your code goes on with

#define SS_PIN 10
#define RST_PIN 9
#define LED_G 5 //define green LED pin
#define LED_R 4 //define red LED
#define BUZZER 2 //buzzer pin

same procedure

what does teh word "#define" do in this code

answer look up the arduino-reference
and find the link
define

best regards Stefan

sevenoutpinball:
what sort of device reads r f Id tags? sounds like fun

RFID-reader for 13,56 MHz-tags

I'll be darned, looks like fun.

Hey i was making a safe using RFID and a servo motor i wanted the sensor to recognize two tags so that i can use two tags for the same project. Im a beginner so i dont know much Can someone please guide me Thanks!!! Ive written the code underneath

#include <SPI.h>
#include <MFRC522.h>
#include <Servo.h>

#define SS_PIN 10
#define RST_PIN 9
#define LED_G 5 //define green LED pin
#define LED_R 4 //define red LED
#define BUZZER 2 //buzzer pin
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
Servo myServo; //define servo name

void setup()
{
Serial.begin(9600); // Initiate a serial communication
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
myServo.attach(3); //servo pin
myServo.write(0); //servo start position

Serial.println("Put your card to the reader...");
Serial.println();

}
void loop()
{
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent())
{
return;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial())
{
return;
}
//Show UID on serial monitor
Serial.print("UID tag :");
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);_
_ content.concat(String(mfrc522.uid.uidByte < 0x10 ? " 0" : " "));
content.concat(String(mfrc522.uid.uidByte, HEX));
}
Serial.println();
Serial.print("Message : ");
content.toUpperCase();
if (content.substring(1) == "59 51 06 5D") //change here the UID of the card/cards that you want to give access*

* {
Serial.println("Authorized access");
Serial.println();
delay(500);*_

* myServo.write(180);*
* delay(5000);*
* myServo.write(0);*

* }*

else {
* Serial.println(" Access denied");*
* digitalWrite(LED_R, HIGH);
_ tone(BUZZER, 300);
delay(1000);_

digitalWrite(LED_R, LOW);
_ noTone(BUZZER);
}
}*_

See reply #1

@rafey121

Please follow the advice on posting a programming question given in Read this before posting a programming question

In particular note the advice to Auto format code in the IDE and to use code tags when posting code here