Logic Machine Forum
motion_cm-19 connet RS485 to LM5-RIO2 - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: motion_cm-19 connet RS485 to LM5-RIO2 (/showthread.php?tid=3218)



motion_cm-19 connet RS485 to LM5-RIO2 - luanpt - 12.03.2021

Dear all.

I have a motor and a curtain controller. Please give me a guide for using over this RS485 protocol. I am using LM5-RIO2

I attach my controller's data.[/font]

https://usermanual.wiki/Coulisse/CM19

Thanks you.


RE: motion_cm-19 connet RS485 to LM5-RIO2 - admin - 12.03.2021

Create an event script attached to a 1-byte unsigned object (valid scene number is from 1 to 15), change CM-19 address (default is 1) and port (default is /dev/RS485-1) if needed.
Code:
addr = 1 -- CM-19 address (default 1)
scene = event.getvalue()

if scene > 0 and scene < 16 then
  value = string.format('!BR%dg%X;', addr, scene)
  port = require('serial').open('/dev/RS485-1', {
    baudrate = 9600,
    duplex = 'half'
  })
  port:write(value)
  port:close()
end



RE: motion_cm-19 connet RS485 to LM5-RIO2 - luanpt - 17.03.2021

(12.03.2021, 09:01)admin Wrote: Create an event script attached to a 1-byte unsigned object (valid scene number is from 1 to 15), change CM-19 address (default is 1) and port (default is /dev/RS485-1) if needed.
Code:
addr = 1 -- CM-19 address (default 1)
scene = event.getvalue()

if scene > 0 and scene < 16 then
  value = string.format('!BR%dg%X;', addr, scene)
  port = require('serial').open('/dev/RS485-1', {
    baudrate = 9600,
    duplex = 'half'
  })
  port:write(value)
  port:close()
end

Thanks admin support.