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.

4 bit dimming script
#1
script for 4 bit dimming to send command to 1 Byte unsigned integer dimming
Reply
#2
Have a look here
https://forum.logicmachine.net/showthrea...27#pid8027
------------------------------
Ctrl+F5
Reply
#3
In 2022 RC1 firmware and later you can use an event script with execution mode set to "Last instance only". Change parameters on first three lines as needed.
Code:
out = '1/1/2' -- output group address (1 byte scale)
stepsize = 5 -- step size in %
sleeptime = 0.5 -- delay in seconds between each step

dimmer = event.getvalue()
step = bit.band(dimmer, 0x07)

if step == 0 then
  return
end

if bit.band(dimmer, 0x08) == 0 then
  stepsize = -stepsize
end

value = grp.getvalue(out)

while true do
  newvalue = math.min(value + stepsize, 100)
  newvalue = math.max(newvalue, 0)

  if newvalue == value then
    break
  end
  
  value = newvalue
  grp.write(out, value)
  os.sleep(sleeptime)
end
Reply


Forum Jump: