16.03.2017, 13:51
Here's the documentation on serial library:
http://openrb.com/docs/serial.htm
Here's a small example that will send back everything that LM reads from RS232 (default serial settings are 115200 8N1):
http://openrb.com/docs/serial.htm
Here's a small example that will send back everything that LM reads from RS232 (default serial settings are 115200 8N1):
Code:
-- open port on first call
if not port then
require('serial')
port = serial.open('/dev/RS232')
port:flush()
end
-- port ready
if port then
-- read one byte
char = port:read(1, 1)
-- send back if read succeeded
if char then
port:write(char)
end
end