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.

Fan motor ramp up
#4
Event script that gets the target level and adjusts the output object in small steps. Adjust as needed:
Code:
output = '1/1/4'
step = 5
delay = 0.5

target = event.getvalue()
current = grp.getvalue(output)

if target == current then
  return
end

while true do
  if current < target then
    current = math.min(current + step, target)
  else
    current = math.max(current - step, target)
  end

  grp.write(output, current)

  -- stop when target is reached
  if current == target then
    return
  end

  os.sleep(delay)

  -- stop when targed changed, another script is running
  if grp.getvalue(event.dst) ~= target then
    return
  end
end
Reply


Messages In This Thread
Fan motor ramp up - by KoBra - 14.02.2022, 15:50
RE: Fan motor ramp up - by Dré - 14.02.2022, 18:31
RE: Fan motor ramp up - by KoBra - 16.02.2022, 06:09
RE: Fan motor ramp up - by admin - 16.02.2022, 07:12
RE: Fan motor ramp up - by KoBra - 16.02.2022, 08:11
RE: Fan motor ramp up - by admin - 16.02.2022, 08:45
RE: Fan motor ramp up - by KoBra - 16.02.2022, 11:35

Forum Jump: