Page 1 of 1

Need help with simple task

Posted: Tuesday 07 February 2017 21:36
by slowdowndave
This is my first attempt at using blockly for what seems like it should be a simple task. I want to turn a fan on for 5 minutes every hour or half hour if the humidity is above 50%. I'm not exactly sure how Blockly works but I assume it follows through each line and then starts back at the beginning. Here's what I have.
Screenshot_20170207-071212.png
Screenshot_20170207-071212.png (19.75 KiB) Viewed 567 times
This what is happening, the fan comes on for 5 minutes and then off for 2.5 minutes.
Screenshot_20170207-071235.png
Screenshot_20170207-071235.png (50.94 KiB) Viewed 567 times

Re: Need help with simple task

Posted: Tuesday 07 February 2017 23:42
by K3rryBlue
You need to add a ELSEIF to the Blocky, now you running in loops.
The lowest value you can reach is 50% and that causes the blocky to keep repeating itself.
Your last step 5 minutes only last the cycle time of the blockly statement (I believe every 30 seconds)

Always remember that if you switch via Blockly, you create a step to exit the statement, as Blockly run in a loop.

Code: Select all

rh = current value

IF rh >= 50
  DO turn FAN on 5 min
ELSEIF rh < 50
  DO turn FAN off 30 min