playfultechnology / arduino-rfid-R200

Arduino/ESP32 code for R200 long-range UHF RFID reader
GNU General Public License v3.0
31 stars 11 forks source link

Serial2 is unknown #3

Closed PoebelPogge closed 2 weeks ago

PoebelPogge commented 2 months ago

Hey, thank you for this awesome work. I tried to get it running with an NodeMCU, but I stumbled over some lines. My Platform IO IDE says that Serial2 is unknown, so I changed it to Serial1, which is a HardwareSerial class. Further I changed in the 200.h file the return type of parseReceivedData() to void, because the return type is never use.

And in my version of HardwareSerial.h there is no way of using: _serial->begin(baud, SERIAL_8N1, RxPin, TxPin); So I changed it to: _serial->begin(baud, SERIAL_8N1, SERIAL_TX_ONLY, TxPin);

But I still don`t receive any information.

Any Idea? I'm sadly a bit new to this whole RFID & RX/TX topic.

dantaeyoung commented 2 months ago

Hey @PoebelPogge - I too was struggling with this and realized that I'm using an Arduino and/or ESP32 that doesn't have HardwareSerial ports.

I ended up finding some of the manufacturer's documentation/software and starting from there.

Here's a repo containing an example BasicTest.ino file that works on my Arduino for testing purposes, in case it helps.

alastaira commented 2 weeks ago

If you change your serial interface to SERIAL_TX_ONLY, you wouldn't expect to receive any information from it!

I'm not familiar with NodeMCU, but if you don't have Serial2 available, you either need to use your primary hardware serial interface (but that will prevent you from printing out the ID of any detected tags on the serial monitor), or else use a library like SoftwareSerial or AltSoftSerial to emulate one on a pair of spare GPIO pins.