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.

Loop problems
#1
Hello,

Once again, I'm in need of help. I'm trying to do a simple script that adds few %'s to a DALI light while holding dimming button. I have the button setup as dimmer (brighter), which gives value 9 when I hold it and value 0 when I don't. This is the script I came up with but of course it doesn't work. The loop doesn't break, it just keeps on going even after 100% and keeps updating it. This code is inside the dimming button.
12/0/0 = stm = DALI light object, which has a scale from 0-100%.
step = number of % it's supposed to jump each ramp_time


Code:
value = event.getvalue()
step = 4
ramp_time = 0.05
stm = grp.getvalue('12/0/0')

while (value == 9) do
  stm = grp.getvalue('12/0/0')
  grp.write('12/0/0', stm + step)
  if (value == 0) then
    break
  end
  os.sleep(ramp_time)
end

I even tried doing: if (value ~= 9) then break but it doesn't work. Any suggestions?
Reply


Messages In This Thread
Loop problems - by Jayce - 09.10.2017, 13:02
RE: Loop problems - by admin - 09.10.2017, 13:32
RE: Loop problems - by Jayce - 09.10.2017, 14:03

Forum Jump: