ArduinoModbus library error with Zero Boards

I have a code I'm using woth Mega board and works fine, If I move to Arduino zero , the same library return these errors (Arduino Modbus library)

..\Documents\Arduino\libraries\ArduinoRS485\src\RS485.h:35:30: error: 'A6' was not declared in this scope

*.\Documents\Arduino\libraries\ArduinoRS485\src\RS485.cpp:191:62: note: in expansion of macro 'RS485_DEFAULT_DE_PIN'

  • RS485Class RS485(SERIAL_PORT_HARDWARE, RS485_DEFAULT_TX_PIN, RS485_DEFAULT_DE_PIN, RS485_DEFAULT_RE_PIN);*

NOTE: I'm not using Modbs RS485, just Modbus TCP

How to fix it?

The library was written for the MKR series of Arduinos. It was never adapted for the Zero and some other boards.
You can edit RS485.h and change the lines

#define RS485_DEFAULT_DE_PIN A6
#define RS485_DEFAULT_RE_PIN A5

so the pins match your actual values.

what is the right synthax for Arduino 0?

As you failed to provide a wiring diagram of your setup, we cannot tell you that.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.