31.10.2024, 11:36
Yes, was trying your provided code. Log is empty.
GND is connected between LM and slave device.
Following code outputs only "Before Write". "After Write" line can't be reached, like write procedures hangs.
GND is connected between LM and slave device.
Following code outputs only "Before Write". "After Write" line can't be reached, like write procedures hangs.
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'N', 8, 1, 'H')
mb:connect()
log("Before Write")
--writing 10 into register 168
res, err = mb:writemultipleregisters(168, 10)
log(res, err)
log("After Write")
mb:close()