🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

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

    Units
    uhf rfid arduino
    2
    2
    2.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kasperhvid
      last edited by

      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..

      1 Reply Last reply Reply Quote 0
      • P
        pierrethr
        last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • First post
          Last post