Modbus protocol

Hello all,
does anyone have an example of modbus slave?
Could the arduino modbus slave example be ported to namino?
Greetings
GMB

in platformio add

lib_deps = 
	emelianov/modbus-esp8266@^4.1.0

and in code

#include <ModbusRTU.h>

ModbusRTU mb;
...
setup...
  Serial1.begin(NAMINO_MODBUS_BAUD, SERIAL_8N1, NAMINO_MODBUS_RX, NAMINO_MODBUS_TX);
  mb.begin(&Serial1, NAMINO_MODBUS_RTS);
  mb.slave(NAMINO_MODBUS_NODE_ID); // or master

  // modbus registers
  mb.addHreg(REG_NUMBER)

loop...
  // reading
  uint16_t reg = mb.Hreg(REG_NUMBER);

  // writing
  mb.Hreg(REG_NUMBER, value);

  // loop
  mb.task();

Many thank!
Same solutions for arduino ide?
GMB

1 Like

if you use Arduino IDE, we suppose you are able to use Arduino IDE, so you can find that a similar solution can be adopted for Arduino IDE.
In other words, you can use this library in the same way you use the other libs in Arduino ide :slight_smile:
In this forum we offer full support primarily regarding Namino products because there are already plenty of tutorials and information about these third party tools.
Anyway after a short Google search (in italian because I suppose you are Italian :wink: ):

1 Like