using RFID control led in tamil
codings for this video
/*
PINOUT:
RC522 MODULE Uno/Nano MEGA
SDA D10 D9
SCK D13 D52
MOSI D11 D51
MISO D12 D50
IRQ N/A N/A
GND GND GND
RST D9 D8
3.3V 3.3V 3.3V
*/
#include <MFRC522.h>
#include <SPI.h>
MFRC522 rfid(10,9); //ss pin(SDA pin) and rst pin
String id = "";
bool type = false;
int successRead;
void setup() {
pinMode(8,OUTPUT);
Serial.begin(9600);
SPI.begin();
rfid.PCD_Init();
Serial.println("scaning");
}
void loop() {
type = !type;
do{
successRead = getID();
}
while (!successRead);
if(id == "9D 22 B5 2D")
{
if(type == true)
{
digitalWrite(8,HIGH);
}
else if(type == false)
{
digitalWrite(8,LOW);
}
}
delay(1000);
id = "";
}
int getID() {
if ( ! rfid.PICC_IsNewCardPresent()) {
return 0;
}
if ( ! rfid.PICC_ReadCardSerial()) {
return 0;
}
Serial.print("Card ID: ");
for (int i = 0; i < rfid.uid.size; i++)
{
id += rfid.uid.uidByte[i] < 0x10 ? " 0" : " ";
id += String(rfid.uid.uidByte[i], HEX);
}
id.trim();
id.toUpperCase();
Serial.println(id);
rfid.PICC_HaltA();
return 1;
}
****************************************************************************
copy the code and must change the UID code or HEX code....
use use tag UID code...
Comments
Post a Comment