Time scheduler for GPIO

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
mra2ko
Normal user
Posts: 80
Joined: 06 Dec 2021, 08:32
Location: Czech Republic

Time scheduler for GPIO

#1 Post by mra2ko » 12 Sep 2022, 12:36

Hi,
I would like run fan every day from 6:00 to 22:00. It is formula below ok ?
Thank


On Clock#Time=All,6:00 do
gpio,14,1
endon
On Clock#Time=All,22:00 do
gpio,14,0
endon

User avatar
Ath
Normal user
Posts: 3416
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Time scheduler for GPIO

#2 Post by Ath » 12 Sep 2022, 21:03

Your solution has the disadvantage that the unit must be running every day at exactly 06:00h or the fan will not be switched on for an entire day, and at 22:00 or the fan won't be switched off until the next day.

You can make it much simpler and reliable using this rule that checks every minute:

Code: Select all

on Clock#Time=All,**:** do
  if %eventvalue2%>=06:00 and %eventvalue2%<22:00
    gpio,14,1
  else
    gpio,14,0
  endif
endon
/Ton (PayPal.me)

Post Reply

Who is online

Users browsing this forum: No registered users and 41 guests