Good day!
I am new to arduino and I need a little bit of help. I have arduino UNO. I am using Modbus-Master-Slave-for-Arduino library to make my arduino slave using simple slave example code:
/**
* Modbus slave example 1:
* The purpose of this example is to link a data array
* from the Arduino to an external device.
*
* Recommended Modbus Master: QModbus
* http://qmodbus.sourceforge.net/
*/
#include <ModbusRtu.h>
// data array for modbus network sharing
uint16_t au16data[16] = {
3, 1415, 9265, 4, 2, 7182, 28182, 8, 0, 0, 0, 0, 0, 0, 1, -1 };
/**
* Modbus object declaration
* u8id : node id = 0 for master, = 1..247 for slave
* u8serno : serial port (use 0 for Serial)
* u8txenpin : 0 for RS-232 and USB-FTDI
* or any pin number > 1 for RS-485
*/
Modbus slave(1,0,0); // this is slave @1 and RS-232 or USB-FTDI
void setup() {
slave.begin( 9600 ); // baud-rate at 9600
}
void loop() {
slave.poll( au16data, 16 );
}
When I set up OpenHab connection with ModBus2.3 binding it just does not connect. But I am able to connect to it using master simulation software. When trying to connect using openhab my arduino uno led is blinking periodically. Is there something wrong with the library? which is the best library for adruino ModBus slave?
Thank you!