Example: Control music volume with Busch-priOn
priOn is setup on group address 10/0/100 (data type 03.007 dimming control). How to make increase music volume by turning the central button clokwise.
Assuming that KNX group address 10/0/101 (data type 05.5byte unsigned integer) range is from 1 – 21 (5% volume increase on each number).
Add the following program which will trigger each time when the group address 10/0/100 on the priOn is activated with central button.
Note! Make sure that the object 10/0/100 is set to data type 3.007 and 10/0/101 to 5.001 in Logic Machine’s Objects tab.
- step = event.getvalue()
- curvol = grp.getvalue('10/0/101')
- newvol = curvol
- -- volume up
- if step == 0x0E then
- newvol = math.min(100, curvol + 5)
- -- volume down
- elseif step == 0x06 then
- newvol = math.max(0, curvol - 5)
- -- set new value
- if newvol ~= curvol then
- grp.write('10/0/101', newvol)