Thresholds - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8) +--- Thread: Thresholds (/showthread.php?tid=5206) |
Thresholds - Bergman - 17.01.2024 Hi, I have a humidity sensor with no threshold options, it only sends humidity on change. I also have a dimmer which controls a fan and I want to control the fan with value depending on humidity level. In 2 or 3 steps/thresholds. Have been searching the forum but cannot find any similar, perhaps im using the wrong keywords. Anyone who can give me a tip on what to use? Regards, Peter RE: Thresholds - RomansP - 17.01.2024 HI Bergman I am not sure that it is exactly what you need, but have a try, and please give me feedback. This code is for humidity scale object (event script). Code: local humidity = event.getvalue() -- scale object Regards, Romans Here is updated version of the script. Code: local humidity = event.getvalue() -- scale object RE: Thresholds - Bergman - 17.01.2024 Thank you RomansP! I think I can use alot of that to make my own newbie-script work. You start off with "Local", what/how does that do/work? I haven't used that or read about it so far. Regards, Peter RE: Thresholds - RomansP - 18.01.2024 In Lua, variables can be either local or global, and their scope determines where they can be accessed. If before variable is local - means variable is local, if before variable is nothing it means variable is global. Here is a pretty good summary about lua. https://learnxinyminutes.com/docs/lua/ But you also can use chatGPT to improve your coding and ask some questions about code. Regards, Romans. |