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

    M5 RS485 Modbus slave sample code does not compile

    Arduino
    arduino
    3
    4
    1.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.
    • LukeSL
      LukeS
      last edited by

      I have an Atom Switch that I want to use RS485 modbus with has not modbus sample code. So I trying to use sample code from the ATOM DTU devices.

      When I try to compile the sample code it gives the following error

      error: no matching function for call to 'RS485Class::RS485Class(HardwareSerial&, int, int, int, int)'
       RS485Class RS485(Serial2, ATOM_DTU_RS485_RX, ATOM_DTU_RS485_TX, -1, -1);
      

      Which makes sense as I don't understand where the RS485Class is defined or how it is in the below code sample. Has anyone got this working?

      #include <M5Atom.h>
      #include <ArduinoModbus.h>
      #include <ArduinoRS485.h>
      #include "ATOM_DTU_NB.h"
      
      const int numCoils            = 10;
      const int numDiscreteInputs   = 10;
      const int numHoldingRegisters = 10;
      const int numInputRegisters   = 10;
      
      RS485Class RS485(Serial2, ATOM_DTU_RS485_RX, ATOM_DTU_RS485_TX, -1, -1);
      
      1 Reply Last reply Reply Quote 0
      • ajb2k3A
        ajb2k3
        last edited by

        Have you downloaded and installed all the libraries required in arduino?

        UIFlow, so easy an adult can learn it!
        If I don't know it, be patient!
        I've ether not learned it or am too drunk to remember it!
        Author of the WIP UIFlow Handbook!
        M5Black, Go, Stick, Core2, and so much more it cant be fit in here!

        LukeSL 1 Reply Last reply Reply Quote 0
        • LukeSL
          LukeS @ajb2k3
          last edited by

          @ajb2k3 yup, all the libraries in the include section are downloaded and the compiler does not throw any missing file errors

          R 1 Reply Last reply Reply Quote 0
          • R
            robertoubeperuzzo @LukeS
            last edited by

            I'm having the same problem testing a similar example in https://github.com/m5stack/ATOM_DTU_LoRaWAN/blob/master/examples/Modbus/ModBus-RTU/Slave/Slave.ino

            Does anyone have a working example to share?

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