What is the best way to code a port to run 3 times a week?
Re: What is the best way to code a port to run 3 times a wee
I tried the code and it worked fine.
I'll set up the other days later.
Thanks everyone.
I'll set up the other days later.
Thanks everyone.
Re: What is the best way to code a port to run 3 times a wee
So if I wanted 9:05pm would it be...
Code: Select all
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowMonday && hour()==2105 && minute()<5)
ReefAngel.Relay.On(Main_RODI);
Re: What is the best way to code a port to run 3 times a wee
no hour() only returns the hour not the time. You'd have to check minute >= 5 && < 10
Re: What is the best way to code a port to run 3 times a wee
So i tried this...
and I'm getting an "expected primary-expression before '<' token" error with the line I'm working on highlighted and the 1st "(" circled.
I'm obviously missing a comma or something, but don't know where.
Code: Select all
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowSunday && hour()==9 >= 5 && < 10 && minute()<5)
ReefAngel.Relay.On(Main_RODI);
I'm obviously missing a comma or something, but don't know where.
Re: What is the best way to code a port to run 3 times a wee
No. You need to check for day of the week, hour and minutes.
If you want minutes >= 5 and minutes < 10, it would be minute()>=5 && minute() <10
If you want minutes >= 5 and minutes < 10, it would be minute()>=5 && minute() <10
Roberto.
Re: What is the best way to code a port to run 3 times a wee
Ok. That makes sense.
Thanks.
So I've got this now and an still getting an error of expected ')' before 'minute'.
I hate trying to figure out error messages. Ugh.
I tried putting a parenthesis () around (minute()>=25 && minute()<30 and got 11 can not be used as a function.
Thanks.
So I've got this now and an still getting an error of expected ')' before 'minute'.
Code: Select all
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowSunday && hour()==11 minute()>=25 && minute()<30 && minute()<5)
ReefAngel.Relay.On(Main_RODI);
I tried putting a parenthesis () around (minute()>=25 && minute()<30 and got 11 can not be used as a function.
Re: What is the best way to code a port to run 3 times a wee
I figured out the error message. I was missing && in between the 11 and the minute, but it doesn't seem to be working.
The way I understand it with this code the Test+Light port, which is port 5 on the main relay, will run Tuesdays from 9:20pm to 9:25pm.
Nothing happened at 9:20pm.
Help???
The way I understand it with this code the Test+Light port, which is port 5 on the main relay, will run Tuesdays from 9:20pm to 9:25pm.
Code: Select all
ReefAngel.Relay.Off(Test_Light);
if (weekday()==dowTuesday && hour()==21 && minute()>=20 && minute()<25 && minute()<5)
ReefAngel.Relay.On(Test_Light);
Help???
Re: What is the best way to code a port to run 3 times a wee
You have an impossible condition: minute >= 20 AND minute < 5. Those 2 conditions are mutually exclusive hence nothing happens. If you remove the " &&minute()<5" clause you should get something between 21:20 and 21:24:59.
Re: What is the best way to code a port to run 3 times a wee
Thanks.
I'll try it later.
I'll try it later.
Re: What is the best way to code a port to run 3 times a wee
That did it. Thanks again.
Re: What is the best way to code a port to run 3 times a wee
I put this code in to turn on the solenoid for my RO/DI unit Monday, Wednesday and Friday on last Friday the 24th.
I just noticed that it only turned on on that Friday. It didn't turn on on Monday or Yesterday (Wednesday).
Is there another way to do multiple if conditions like Roberto suggested?
I just noticed that it only turned on on that Friday. It didn't turn on on Monday or Yesterday (Wednesday).
Is there another way to do multiple if conditions like Roberto suggested?
Code: Select all
//Flush RO/DI Membrane 3 times a week @ 9pm.
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowMonday && hour()==21 && minute()<5)
ReefAngel.Relay.On(Main_RODI);
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowWednesday && hour()==21 && minute()<5)
ReefAngel.Relay.On(Main_RODI);
ReefAngel.Relay.Off(Main_RODI);
if (weekday()==dowFriday && hour()==21 && minute()<10)
ReefAngel.Relay.On(Main_RODI);
Re: What is the best way to code a port to run 3 times a wee
You should have just one Off at the beginning of the if statements or they will override the previous ones
Roberto.
Re: What is the best way to code a port to run 3 times a wee
Ok. I guess that is what's been happening. Thanks.
Re: What is the best way to code a port to run 3 times a wee
It worked perfectly.
I had a test time yesterday at 9pm, which went off fine and then it went off again tonight, as well as the other port turned on at 9:05.
Thanks for all the help.
I learned a bunch with this.
I had a test time yesterday at 9pm, which went off fine and then it went off again tonight, as well as the other port turned on at 9:05.
Thanks for all the help.
I learned a bunch with this.