Page 1 of 1

Turn relay on/off at specific times

Posted: Fri Mar 03, 2017 11:26 pm
by benjy1234
Sorry about the noob question

I have a small powerhead id like to turn on for a few minutes at a time multiple times during the day. I use it to create some turbulent water in my sump when my doser comes on. I want it to come on at around 4:50am till 5:10am then at the same intervals at 6am 9pm and 10 pm. THis is what I tried but it just leaves the pump on:

if (hour()>=4,53 && hour()<5,07)
{
ReefAngel.Relay.On(Port7);
}
else
{
ReefAngel.Relay.Off(Port7);
}

if (hour()>=5,53 && hour()<6,07)
{
ReefAngel.Relay.On(Port7);
}
else
{
ReefAngel.Relay.Off(Port7);
}

if (hour()>=20,53 && hour()<21,07)
{
ReefAngel.Relay.On(Port7);
}
else
{
ReefAngel.Relay.Off(Port7);
}

if (hour()>=21,53 && hour()<22,07)
{
ReefAngel.Relay.On(Port7);
}
else
{
ReefAngel.Relay.Off(Port7);
}

Thanks for any help! You guys are awesome!

Re: Turn relay on/off at specific times

Posted: Sat Mar 04, 2017 4:53 am
by cosmith71
Your if statements need to look like this:

Code: Select all

if ((hour() >= 4 && minute() >= 53) && (hour() <5 && minute() < 7))
Just change the hour and minutes appropriately for each section. I think the rest is fine.

--Colin

Re: Turn relay on/off at specific times

Posted: Sat Mar 04, 2017 3:54 pm
by benjy1234
Oh perfect! Thanks Colin!

Re: Turn relay on/off at specific times

Posted: Sat Mar 04, 2017 4:29 pm
by cosmith71
You're welcome!