UHF RFID unit problems interfacing with arduino mega using code example from github



  • Hello,

    I have purchased your reader and i am trying to port the library from this url:

    https://github.com/m5stack/M5Unit-UHF-RFID

    To work on an arduino mega. So far i'm not having much luck. I can't even get the UHF RFID unit to print its version using getVersion in setup void much less read my tags..

    I have made the following changes to the .begin void in order to accomodate it being a mega:

    /*! @brief Initialize the Unit UHF_RFID.*/
    void Unit_UHF_RFID::begin(HardwareSerial *serial, long baud, bool debug) {
       _debug  = debug;
       _serial = serial;
       _serial->begin(baud);
    }
    

    And then my setup void looks like this:

    #include "Unit_UHF_RFID.h"
    
    Unit_UHF_RFID uhf;
    
    String info = "";
    
    void setup() {
     // put your setup code here, to run once:
     Serial.begin(9600);
     Serial.println("Serial begin");
    
     uhf.begin(&Serial2, 115200, false);
    
     Serial.println("Serial begin2");
    
     while (1) {
       info = uhf.getVersion();
       Serial.println("Version: "+info);
       if (info != "ERROR") {
         Serial.println(info);
         break;
       }
     }
     Serial.println("Version: "+info);
     // max: 26dB
     uhf.setTxPower(2600);
    
    
    }
    

    Hope someone can help me understand why this isn't working..



  • Hi @kasperhvid, any luck on that?
    I was hoping to do the same but all I get is an obscure "ERROR" response back from the getVersion() method.