20.04.2017, 12:10
Code:
if not port then
require('serial')
port = serial.open('/dev/RS232', { baudrate = 9600 })
port:flush()
line = ''
end
char = port:read(1, 1)
if char then
if char == '\r' then
line = line:trim()
alert(line)
line = ''
else
line = line .. char
end
end