This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

RS-232 Projector control
#1
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:


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.

Attached Files Thumbnail(s)
   
Reply


Messages In This Thread
RS-232 Projector control - by SevenP - 15.03.2023, 14:26
RE: RS-232 Projector control - by Daniel - 15.03.2023, 14:36
RE: RS-232 Projector control - by SevenP - 15.03.2023, 14:41
RE: RS-232 Projector control - by admin - 15.03.2023, 14:45

Forum Jump: