08.05.2019, 15:32
(08.05.2019, 13:59)admin Wrote: You need to apply a bit mask like this:
Code:addr = bit.band(value, 0x3F)
Thank you admin. It works perfectly. So the final code to get the dali device address starting with 1->64 it will be likeĀ this :
Code:
value = event.getvalue()
addr = bit.band(value, 0x3F)
function getbit(value, nr)
value = bit.rshift(value, nr)
return bit.band(value, 1) == 1
end
grp.checkupdate('32/1/50', (addr + 1))
grp.checkupdate('32/1/51', getbit(value, 6))
grp.checkupdate('32/1/52', getbit(value, 7))