@dda Are there any other solucions to connect RFID to M5Stack?
Posts made by Ddaniel
-
RE: M5Stack - Simple Applications for RFID- Arduino
-
M5Stack - Simple Applications for RFID- Arduino
HI,
I would like to connect a RFID reader to a M5Stack, I have a RC522 sensor witch is connected like this SDA to SDA, SCK to SCK, MOSI to MO, MI to MI, Reset to 1. I have this code:#include <SPI.h>
#include <MFRC522.h>
#include <M5Stack.h>#define RST_PIN 1 //Pin 1 para el reset del RC522
#define SS_PIN 21 //Pin 21 para el SS (SDA) del RC522
MFRC522 mfrc522(SS_PIN, RST_PIN); //Creamos el objeto para el RC522void setup() {
M5.begin();
Serial.begin(9600); //Iniciamos la comunicación serial
SPI.begin(); //Iniciamos el Bus SPI
mfrc522.PCD_Init(); // Iniciamos el MFRC522
Serial.println("Lectura del UID");
M5.Lcd.println("Lectura del UID");
}void loop() {
// Revisamos si hay nuevas tarjetas presentes
if ( mfrc522.PICC_IsNewCardPresent())
{
//Seleccionamos una tarjeta
if ( mfrc522.PICC_ReadCardSerial())
{
// Enviamos serialemente su UID
Serial.print("Card UID:");
M5.Lcd.println("Card UID:");
for (byte i = 0; i < mfrc522.uid.size; i++) {
Serial.print(mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
M5.Lcd.print (mfrc522.uid.uidByte[i] < 0x10 ? " 0" : " ");
Serial.print(mfrc522.uid.uidByte[i], HEX);
M5.Lcd.print (mfrc522.uid.uidByte[i], HEX);
}
Serial.println();
M5.Lcd.println();
// Terminamos la lectura de la tarjeta actual
mfrc522.PICC_HaltA();
}
}
´´
Unfortunately does not work.
Please, could somebody give me an advise, something simple...
In the future I want to create a door access.
Thank you in advance.