A library that allows your Arduino to communicate via Modbus protocol, acting as a slave (master in development). Supports serial (RS-232, RS-485) and IP via Ethernet (Modbus IP).
BSD 3-Clause "New" or "Revised" License
453
stars
267
forks
source link
Coils go to 0 at start regardless of what the set value is #58
I have this block of code in my setup(), which should theoretically set all coils to 1, but when I turn on the arduino the coils go to 0, and only go to the correct value when I send a modbus command to the arduino (even a read). Is there something that I am not understanding or is this a bug?
const bool defaultCoilValue = 1;
for (int i = startCoilAddress; i <= numberOfCoils; i++) {
mb.addCoil(i, defaultCoilValue);
mb.addIsts(i, defaultCoilValue);
}
I have this block of code in my
setup()
, which should theoretically set all coils to 1, but when I turn on the arduino the coils go to 0, and only go to the correct value when I send a modbus command to the arduino (even a read). Is there something that I am not understanding or is this a bug?