Unable to read data from RFID tag using YHY502CTG and Arduino Nano

19 Views Asked by At

I can see the LED flash on the RFID Reader, indicating that it detects the presence of a tag. But when I try to transmit hex data I dont receive anything from the reader.

This is what I was trying to do :-

#include <SoftwareSerial.h>

SoftwareSerial yhy502Serial(2, 3); // RX, TX - Connect YHY502 TX to Arduino D2, YHY502 RX `your text`to Arduino D3

void setup() {
   Serial.begin(9600);      // Initialize serial communication with the USB port
   yhy502Serial.begin(9600); // Initialize serial communication with YHY502 module
}

void loop() {
   if (yhy502Serial.available() > 0) { // Check if data is available from YHY502 module
      char incomingByte = yhy502Serial.read(); // Read incoming data from YHY502 module
      Serial.print(incomingByte); // Print the received data to the Serial monitor
   }
}
0

There are 0 best solutions below