Hi guys im a little stuck for how to set this up correctly,
plan is that when it is day time (set by an RTC triggering an alarm) then the fan will be switchable based on whether it is above or below a threshold.
but when it is night (also set by an RTC) then the fan is not switchable
the way i think to do it is set a variable during the alarm so in the morning it sets x=1 and at night x=0
that way with my if commands i could say
if ((x == 1) && (BaskTemp < Threshold)) ← important bit
digitalWrite etc
else digital write low
Would this work? how would i set x to be a variable ?
KeithRB:
I suggest that you create a function that determines whether it is day or night and returns a boolean, rather than a variable, so it becomes:
if ((isDay()) && (BaskTemp < Threshold)) {}
^^ this is a good way to do it, yes but also look for state changing, not only if BaskTemp is below the setting…
also, here is another DailyTimer library I wrote for (obviously) daily timers with a lot of flexibility and is easy to use. I wrote it because I am constantly doing little automation projects that use timers like you describe.
you may want to check out Automaton (what?what?) by @Tinkerspy, which may make your project easier.