15.03.2023, 14:26
Hello,
I am trying to control a projector via RS232 protocol. I own LogicMachine 5 Lite.
So far it has created a virtual object for simple on/off control, I have attached an event-script to it:
Is the above script sufficient? I understand that by defining the communication in the script I don't need to set anything else in the tab with "Modbus"?
In the logs it seems to me that the script returns a "nil" error when writing, what does this mean?
I have the LM5 Lite + Ext (i.MX6) firmware uploaded.
The cable issues can be dismissed, I have swapped TX with RX more than once.
I would be grateful for any help.
Log response in attachment.
I am trying to control a projector via RS232 protocol. I own LogicMachine 5 Lite.
So far it has created a virtual object for simple on/off control, I have attached an event-script to it:
Code:
require('serial')
device = '/dev/RS232'
port = serial.open(device, { baudrate = 9600, parity = 'none', databits = 8, stopbits = 1, duplex = full })
port:flush()
-- get value of KNX object
value = event.getvalue()
log(value)
if (value == true) then
-- send power on command with returns to make them stick
char = "\r*pow=on#\r"
log("wyslka on")
res, err = port:write(char)
log('blad:', err)
else
-- send power off command
char = "\r*pow=off#\r"
log("wyslka off")
res, err = port:write(char)
log('blad: ', err)
end
-- close port
port:close()
Is the above script sufficient? I understand that by defining the communication in the script I don't need to set anything else in the tab with "Modbus"?
In the logs it seems to me that the script returns a "nil" error when writing, what does this mean?
I have the LM5 Lite + Ext (i.MX6) firmware uploaded.
The cable issues can be dismissed, I have swapped TX with RX more than once.
I would be grateful for any help.
Log response in attachment.