here my simple code with simple arduino code:
`#include <SPI.h>
#include <MFRC522.h>
#include <SoftwareSerial.h>
// Pin configuration for RC522 RFID module
#define RST_PIN 9 // Reset pin for RFID
#define SS_PIN 10 // Slave Select pin for RFID
// Create MFRC522 instance
MFRC522 mfrc522(SS_PIN, RST_PIN);
// Set up HC-05 Bluetooth on SoftwareSerial (Pin 10 and Pin 11 are used for RFID)
SoftwareSerial Bluetooth(2, 3); // RX, TX for Bluetooth communication
void setup() {
// Start communication with the Serial Monitor and Bluetooth
Serial.begin(9600); // For debugging via Serial Monitor
Bluetooth.begin(9600); // Set baud rate for HC-05
SPI.begin(); // Initialize SPI for communication with RC522
mfrc522.PCD_Init(); // Initialize the MFRC522 module
Serial.println(“Ready to read RFID tag.”);
}
void loop() {
// Check if a new card is present
if (mfrc522.PICC_IsNewCardPresent()) {
// If a card is detected, read its UID
if (mfrc522.PICC_ReadCardSerial()) {
String uid = “”; // String to hold the UID
// Read each byte of the UID and store it in the uid string
for (byte i = 0; i < mfrc522.uid.size; i++) {
uid += String(mfrc522.uid.uidByte[i], HEX);
}
// Send the UID to the Bluetooth device
Bluetooth.println(uid); // Send UID via Bluetooth
// Print UID to Serial Monitor for debugging
Serial.print("UID: ");
Serial.println(uid);
// Halt the card and prepare for the next scan
mfrc522.PICC_HaltA();
mfrc522.PCD_StopCrypto1();
}
}
delay(1000); // Delay between scans
}
`
to where can i connect this block that is not a button? that will auto reat and put the uid in the text box?
i think its background task but the app stay open and not closed, so i dont really know
i dont need to listen when app close
i need to sign in the user with this uid that he scans on arduino rfid 522 and hc05 transfers it to the app.