EasyManua.ls Logo

Embedded Systems LogiMachine5 Power - Page 199

Embedded Systems LogiMachine5 Power
254 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
199
If command expects a reply it must be addressed so only one slave can reply, otherwise a
collision will happen. In case of success, reply is a binary string, usually consisting of a single
byte. You can convert it to number like this:
-- query status of slave with short address 5 on the internal DALI bus
res, err = dalicmd('internal', 'querystatus', { addrtype = 'short', address = 5 })
-- read ok
if res then
status = res:byte()
end
If command has a value range, params table must have a value field which is an integer in the
specified range. For example, arc command accepts a value from 0 to 254:
-- set level to 42 for all slave on the internal DALI bus
dalicmd('internal', 'arc', { addrtype = 'broadcast', value = 42 })
Setting DTR
For commands where DTR is needed prior to executing command, use setdtr command to set the
value:
-- set dtr for ballast 5 to 200
dalicmd('internal', 'setdtr', { addrtype = 'short', address = 5, value = 200 })
Example (use gateway with id 1, switch all ballasts off, set ballast with short address 5 to full
on)
require('user.dali')
dalicmd(1, 'arc', { addrtype = 'broadcast', value = 0 })
dalicmd(1, 'arc', { addrtype = 'short', address = 5, value = 254 })
Example (set maximum value for ballast 5 to value 200; the ballast is connected on internal
DALi gateway on LogicMachine )
require('user.dali')
dalicmd('internal', 'setdtr', { addrtype = 'short', address = 5, value = 200 })
dalicmd('internal', 'storemax', { addrtype = 'short', address = 5 })

Table of Contents