01.08.2017, 07:05
Hello,
Do anyone know a good way to detect if there is or there is no connection with Modbus TCP device?
Do anyone know a good way to detect if there is or there is no connection with Modbus TCP device?
Code:
require('luamodbus')
mb = luamodbus.rtu()
mb:open('/dev/RS485-1', 9600, 'E', 8, 1, 'H')
mb:connect()
mb:setslave(1)
mb:setresponsetimeout(100)
-- --
-- some modbus reading --
-- --
mb:close()