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.

Button dimming (8-bit value)
#1
Hey,

I'm trying to dim a RGB led strip using nothing but a button and logic machine. Basically what I need is to get 8-bit value from a button so that when I hold the button, value toggles between going up and down. Is this possible? If not, what is the best way to control dimming dali lights using a simple button (or two, one up one down), preferably without using any scripts.
Reply
#2
Hi,

Check this article: https://forum.logicmachine.net/showthrea...38#pid1238

BR,

Erwin
Reply
#3
(09.04.2018, 15:56)Erwin van der Zwart Wrote: Hi,

Check this article: https://forum.logicmachine.net/showthrea...38#pid1238

BR,

Erwin

Thank you very much for help, bear in mind I'm a beginner though. I tried what you posted about 3bit dimming object, got to a point where i'm supposed to set value after _ in longpresstime_xx. I can't seem to find longpresstime_xx anywhere in the javascript that I pasted in custom javascript. Could you help me please?

EDIT: Nevermind, I figured it out but now I'm having problems with linking the dim UP and DOWN buttons to a real physical buttons I have set up and to the RGB led strip.
Reply
#4
Hi,

You could try something like this:

Code:
1234567891011121314151617181920212223242526272829
addressbyteoutput = '32/1/1' stepsize = 10 value = event.getvalue() current = grp.getvalue(addressbyteoutput) if value < 8 then  if current <= stepsize then    output = 0    if current ~= output then      grp.write(addressbyteoutput, output)    end  else    output = current - stepsize    if current ~= output then      grp.write(addressbyteoutput, output)    end  end elseif value > 8 then  if current >= (100 - stepsize) then    output = 100    if current ~= output then      grp.write(addressbyteoutput, output)    end  else    output = current + stepsize    if current ~= output then      grp.write(addressbyteoutput, output)    end  end end
BR,

Erwin
Reply
#5
Hello,

Excuse me again, how do I try that? Where should I put the script and what should the addressbyteoutput address be? As I said I'm a beginner, if you have time, could you please walk me through this?

Right now I'm in a state where I have done all from the link you sent me, I have two buttons in my visualization, one UP and one DOWN, both have longpresstime set to 10 (1 second). Also, I have 1/1/199, which is my LED strip that I scanned from dali section in LM, I can control the strip with 1 byte unsigned integer.
Reply
#6
Hi,

Just create a 4 bit object that is connected to your physical KNX pushbutton (dimming object), add the script as event based to this object, create a byte SCALE object for your RGB DALI unit and set this object (1/1/199) as addressbyteoutput.

Then it should work..

But do i understand it correct from your last post that you use LM dali interface? If that is the case you should be able to use the commands from http://openrb.com/docs/dali.htm and then you should not be needing this script..

BR,

Erwin
Reply
#7
Yes, I'm using Logic Machines DALI Gateway, sorry for not mentioning earlier.
Reply
#8
Sorry to bother again but would you mind walking me through the method with dali commands you said? Also, what I mean by dimming the RGB strip with pushbutton is that when I hold the button the value goes gradually up. Not sure if I mention this either.
Reply
#9
Hi,

How are you going to config the pushbutton? 
As 4 bit dimming?

BR,

Erwin
Reply
#10
Hello,

Yes, I have set the pushbutton so it is 1bit switching and 3bit dimming. That makes 4bit.
Reply
#11
We plan to implement 4-bit dimming in DALI gateway plugin soon.
Reply
#12
Is it possible to make a single switch:
1 short push , toggle on / off (remember last state if dimmed)
1 long push, dim up and for next long push, dim down and so on?
Reply
#13
It doesn't have to be 4bit for me, is there any way to make it work so a pushbutton controls dimming of a dali light when using LMs dali gateway? All I'd like it to do is to dim up/down while I hold the button.

Thank you.
Reply
#14
Hi
You can do it as fallow.
Create 4 bit dim object 3.007 and let all parameters as default.
Create event based script on this object and use this script.

Code:
123456789101112131415161718192021222324252627282930313233343536373839
step = 10    --dimming step stepTime = 0.5  --- dimming interval ballastAddress = 1   gatewayID='internal' ----------------------------------------------------------------------------------------------------- valuein = event.getvalue() require('user.dali')    res, err = dalicmd(gatewayID, 'queryactual', { addrtype = 'short', address = ballastAddress })  -- read ok         if res then      status = res:byte()         end while( valuein==11 ) do  status = status + step     if (status >254) then              dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress, value = 254})          else      dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress, value = status})     end  valuein = grp.getvalue(event.dst)  os.sleep(stepTime) end     while( valuein==3 ) do  status = status - step      if (status <0) then          dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress, value = 0})          else        dalicmd(gatewayID, 'arc', { addrtype = 'short', address = ballastAddress, value = status})      end    valuein = grp.getvalue(event.dst)  os.sleep(stepTime) end

Modify parameters
Add this object on to visu and test.
Should work :Smile
Dalli arc is logarithmic curve so you will have slower dim on low values and fast on bigger.

BR
------------------------------
Ctrl+F5
Reply
#15
Works very well, thank you very much.
Reply
#16
(10.04.2018, 10:50)Erwin van der Zwart Wrote: Hi,

You could try something like this:

Code:
1234567891011121314151617181920212223242526272829
addressbyteoutput = '32/1/1' stepsize = 10 value = event.getvalue() current = grp.getvalue(addressbyteoutput) if value < 8 then  if current <= stepsize then    output = 0    if current ~= output then      grp.write(addressbyteoutput, output)    end  else    output = current - stepsize    if current ~= output then      grp.write(addressbyteoutput, output)    end  end elseif value > 8 then  if current >= (100 - stepsize) then    output = 100    if current ~= output then      grp.write(addressbyteoutput, output)    end  else    output = current + stepsize    if current ~= output then      grp.write(addressbyteoutput, output)    end  end end
BR,

Erwin

Hello. I'm trying this event script with a 4 bit object from KNX, but it only dimms with many "long-pressed" actions, and not mantaining the KNX button switch. Is it the problem on the KNX side or script's?

Attached Files Thumbnail(s)
   
Reply
#17
Why do you need a script if this switch supports "dimming steps" mode?
Reply
#18
(09.11.2021, 09:09)admin Wrote: Why do you need a script if this switch supports "dimming steps" mode?

Is that the solution? I've never used that option. I'm going to try that. Thank you!

Edit: Confirmed. It works using "dimming steps" option + your 4 bit object dimming script. It has to be done like that because I needed to dim some Philips Hue LED strips from a KNX single button.
Reply


Forum Jump: