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.

Button through RS485
#1
Hello,

I have a plain button (non-knx) which I want to control through LM, unfortunately I don't have any analog ports in my LM type. I've read somewhere that I can simply connect the button to RS485 port in the LM (A and gnd). I need a script for that. I've found this script which I modified for me and it does transfer but all I get after pressing the button is 1. There is also a huge delay (when I get 1 I have to wait a while for it to work again, I'm suspecting that this might be because of wrong baudrate. What I need though is to get 1/0 according to the state of that button.

Code:
-- open port on first call
if not port then
require('serial')
port = serial.open('/dev/RS485-1', { baudrate = 4800, parity = 'odd', duplex = 'half', databits = 8, stopbits = 1 })
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

grp.write('30/1/1', char)
Reply


Messages In This Thread
Button through RS485 - by Jayce - 08.06.2018, 14:12
RE: Button through RS485 - by Jayce - 11.06.2018, 07:38

Forum Jump: