* RST/Reset RST 9
* SPI SS SDA(SS) 10
* SPI MOSI MOSI 11
* SPI MISO MISO 12
* SPI SCK SCK 13
#include <SPI.h>
#include <MFRC522.h>
#define RST_PIN 9 // Configurable, see typical pin layout above
#define SS_PIN 10 // Configurable, see typical pin layout above
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
byte accessUID[4] = {0x23, 0xC5, 0x7D, 0x90};
int LedR = 3;
int LedG = 4;
void setup() {
pinMode(LedR, OUTPUT);
pinMode(LedG, OUTPUT);
SPI.begin(); // Init SPI bus
mfrc522.PCD_Init(); // Init MFRC522
}
void loop() {
// Reset the loop if no new card present on the sensor/reader. This saves the entire process when idle.
if ( ! mfrc522.PICC_IsNewCardPresent()) {
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial()) {
return;
}
if(mfrc522.uid.uidByte [0] == accessUID [0] && mfrc522.uid.uidByte [1] == accessUID [1] && mfrc522.uid.uidByte [2] == accessUID [2] && mfrc522.uid.uidByte [3] == accessUID [3]) {
digitalWrite(LedG, HIGH);
delay(1000);
digitalWrite(LedG, LOW);
}
//demande au lecteur de poutsuivre l'analyse
mfrc522.PICC_HaltA();
}