This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Color spectrum dimming
#1
Hello everybody!

I was wondering if it is possible to make this kind of "effect" with a simple RGB strip. When holding a simple push button set to dimming, colors of the strip would go across the spectrum of all colors (with speed / step size as I choose), when released it would stay at that color. Second button would do the same but backwards. Not sure if this would be any effective but it's the only way I thought of to make this using a physical push button. I have 3 unsigned integer group adresses (R,G,B). I tried to do it with this script I lightly modified but it doesn't work well. The script is in two event scripts, both 3 byte dimming from a pushbutton, one is set to brighter (ON) and the second one to darker (OFF).
Code:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
step = 1 stepTime = 0.001 ballastAddress1 = 19 --RED ballastAddress2 = 27 --GREEN ballastAddress3 = 28 --BLUE gatewayID='internal' ----------------------------------------------------------------------------------------------------- valuein = event.getvalue() require('user.dali')    res, err = dalicmd(gatewayID, 'queryactual', { addrtype = 'short', address = ballastAddress1 })    res, err = dalicmd(gatewayID, 'queryactual', { addrtype = 'short', address = ballastAddress2 })    res, err = dalicmd(gatewayID, 'queryactual', { addrtype = 'short', address = ballastAddress3 })  -- read ok        if res then      status = res:byte()        end while( valuein==9 ) do  status = status + step     if (status >254) then              dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress1, value = 254})              dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress2, value = 254})              dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress3, value = 254})          else      dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress1, value = status})      dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress2, value = status})      dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress3, value = status})     end  valuein = grp.getvalue(event.dst)  os.sleep(stepTime) end     while( valuein==1 ) do  status = status - step      if (status <0) then          dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress1, value = 0})          dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress2, value = 0})          dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress3, value = 0})          else        dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress1, value = status})        dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress2, value = status})        dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress3, value = status})      end    valuein = grp.getvalue(event.dst)  os.sleep(stepTime) end
Reply
#2
Hi
I would do it in resident script which would be enabled/disabled by your object. This script might help you https://forum.logicmachine.net/showthread.php?tid=157
BR
------------------------------
Ctrl+F5
Reply


Forum Jump: