filmov
tv
Arduino Tutorial 30# How to make Arduino Based RFID (RC522) Door Lock
Показать описание
Arduino Tutorial 30# How to make Arduino Based RFID (RC522) Door Lock
Scroll down for code.....
Please like & Subscribe for more videos
RFID library
If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
LIST OF COMPONENT (affiliate links)
#include (MFRC522.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
#include (SPI.h)
#include (Servo.h)
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
MFRC522::MIFARE_Key key;
int code[] = {94,73,241,250}; //This is the stored UID
int codeRead = 0;
int Buzzer = 6;
int activate =0;
Servo myservo;
String uidString;
void setup() {
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init MFRC522
pinMode(Buzzer,OUTPUT);
}
void loop() {
if( rfid.PICC_IsNewCardPresent())
{
readRFID();
}
delay(100);
}
void readRFID()
{
rfid.PICC_ReadCardSerial();
// Check is the PICC of Classic MIFARE type
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
return;
}
int i = 0;
boolean match = true;
{
{
match = false;
}
i++;
}
if(match)
{ if (activate==0){
delay(1000);
activate = activate+1;
}
else
activate = 0;
delay(1000);
}
}
else
{
tone(6,400,1000);
}
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}
void printDec(byte *buffer, byte bufferSize) {
for (byte i = 0; i ( bufferSize; i++) {
}
}
Scroll down for code.....
Please like & Subscribe for more videos
RFID library
If you want to support my video please buy any product through my amazon affiliate link. I will receive a commission, at no extra cost to you.
LIST OF COMPONENT (affiliate links)
#include (MFRC522.h) //instead of parenthesis () put angle bracket as YouTube description does not allow angle bracket
#include (SPI.h)
#include (Servo.h)
#define SS_PIN 10
#define RST_PIN 9
MFRC522 rfid(SS_PIN, RST_PIN); // Instance of the class
MFRC522::MIFARE_Key key;
int code[] = {94,73,241,250}; //This is the stored UID
int codeRead = 0;
int Buzzer = 6;
int activate =0;
Servo myservo;
String uidString;
void setup() {
SPI.begin(); // Init SPI bus
rfid.PCD_Init(); // Init MFRC522
pinMode(Buzzer,OUTPUT);
}
void loop() {
if( rfid.PICC_IsNewCardPresent())
{
readRFID();
}
delay(100);
}
void readRFID()
{
rfid.PICC_ReadCardSerial();
// Check is the PICC of Classic MIFARE type
if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
return;
}
int i = 0;
boolean match = true;
{
{
match = false;
}
i++;
}
if(match)
{ if (activate==0){
delay(1000);
activate = activate+1;
}
else
activate = 0;
delay(1000);
}
}
else
{
tone(6,400,1000);
}
// Halt PICC
rfid.PICC_HaltA();
// Stop encryption on PCD
rfid.PCD_StopCrypto1();
}
void printDec(byte *buffer, byte bufferSize) {
for (byte i = 0; i ( bufferSize; i++) {
}
}
Комментарии