EasyManua.ls Logo

Embedded Systems LogiMachine5 Power - Page 200

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...
200
Example (log all ballast short addresses which are connected to internal DALI gateway)
require('user.dali')
res, err = dalicmd('internal', 'queryshortaddr', { addrtype = 'broadcast' })
if res then
log(res:byte())
else
log(err)
end
Example (add 4 DALI short addressed to one group with nr. 7)
require('user.dali')
dalicmd('internal', 'addtogroup', { addrtype = 'short', address = 1, value = 7 })
dalicmd('internal', 'addtogroup', { addrtype = 'short', address = 2, value = 7 })
dalicmd('internal', 'addtogroup', { addrtype = 'short', address = 3, value = 7 })
dalicmd('internal', 'addtogroup', { addrtype = 'short', address = 4, value = 7 })
Setting group 7 to a certain value (event-based script, object type 1 byte 0..100%):
require('user.dali')
value = event.getvalue()
value = math.floor(value * 2.54)
dalicmd('internal', 'arc', { addrtype = 'group', address = 7, value = value })
Example (functions for calling and saving scenes, can be used not only for DALI)
First, you have to define each scene via a Lua table where each item is a table with two items:
group address and value. Each scene has a unique id which can be a number or a string.
callscene(id) sets all objects in given scene to their specified value. First it looks for a saved
scene in storage and uses default values if storage is empty.
savescene(id) gets current values of all objects from given scene and saves the whole scene in
storage.
scenes = {}
scenes[1] = {

Table of Contents