Dear Daniel
I tried this in a resident script with 0 interval like this but it seems this script does not get executed every second...
When I remove the last line "res, err = port:read(17)" it gets executed every second.
Could you tell me if I am doing anything wrong?
I tried this in a resident script with 0 interval like this but it seems this script does not get executed every second...
When I remove the last line "res, err = port:read(17)" it gets executed every second.
Could you tell me if I am doing anything wrong?
Code:
if not port then
require('serial')
port = serial.open('/dev/RS485-1', {
baudrate = 19200,
databits = 8,
stopbits = 1,
parity = 'none',
duplex = 'half'
})
end
log('executed')
if storage.get('coldBathAutoStartCommand') ~= nil then
port:write(storage.get('coldBathAutoStartCommand'))
os.sleep(1)
port:write(':RR\r\n')
storage.set('coldBathAutoStartCommand', nil)
end
port:flush()
res, err = port:read(17)