"Entry" Level Controllable Pumps?

Talk about you and your tank/equipment

Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Thu Feb 28, 2013 1:08 pm
Couldnt this read && also?
if (hour()>=22 || hour()<12)
Image

Posts: 12877
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Feb 28, 2013 1:14 pm
AS I said && means AND and || means OR.
Just use them just as you were if you were doing it in plain English.
If the hour is less than 9 or hour is greater than 20 would be
if (hour()<9 || hour()>20)
Roberto.

Posts: 12877
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Thu Feb 28, 2013 1:15 pm
Paulturner911 wrote:Couldnt this read && also?
if (hour()>=22 || hour()<12)

If you use and in here, the condition will never be true.
How is the hour going to be at the same time greater than 22 and less than 12??
If it's 23 hours, it's greater than 22 but it will never be less than 12.
Roberto.
User avatar
Posts: 2871
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
PostPosted: Thu Feb 28, 2013 2:10 pm
lnevo wrote:It's basic logic statements...

AND or OR

So take an example a blue ball...

if (ball=blue) && (ball=round) then true
if (ball=blue) && (ball=cube) then false
if (ball=blue) || (ball=yellow) then true
if (ball=blue) || (ball=cube) then true

So AND both sides need to be true for the condition to work...
For OR only one side needs to be true for the conditional needs to be true.

good example wording. we should probably create a sticky thread or document primer for coding on arduino and how the logical operators work. maybe we can collaborate and come up with something for people to use. what do you think?
User avatar
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Thu Feb 28, 2013 4:46 pm
Yeah we need that.. A doc, a stickie, or maybe a wiki. We need a good repo of snippets for some functions and some tips and tricks too... So many questions get asked answered and asked again...but alas...who has time . We need all the grateful non-coders to work on that ;)

I'm happy to help and contribute...just no time to coordinate and make it good...oh well

Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Fri Mar 01, 2013 8:01 am
I see!! I WAS seeing it like this....if it is after 10pm AND before 9am(the next day)....which just isnt how it works.

I cant thank you guys enough for getting me crawling, Ill be walking one day. I try to search for the most part of what I need and post to ask about, or if it would work for me. You guys are always there to set me straight. I speak very highly of the product and even higher of the customer service/forum.
Im currently building a new light fixture 3mh 150 w/ retrofit LED (4pwm drivers) that Ill be looking to code some sunrise/sunset and lightening on demand...so Ill be back :)
Image

Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Sat Mar 02, 2013 3:37 pm
Placed just above custom code

ReefAngel.WavemakerRandom1(Port5);
ReefAngel.WavemakerRandom2(Port6);

"no matching function for call to ReefAngel.WavemakerRandom1(int)"

I thought this is how to make them completely random?
Image
User avatar
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am
PostPosted: Sat Mar 02, 2013 4:31 pm
Odd the function should be for a byte not an int.

Try just putting the number instead of PortX

Posts: 288
Joined: Wed Jan 23, 2013 12:36 pm
PostPosted: Sat Mar 02, 2013 6:49 pm
lnevo wrote:Odd the function should be for a byte not an int.

Try just putting the number instead of PortX

No go same error. I guess if I can't get it completely random I could come up with some times.
Image

Posts: 12877
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sat Mar 02, 2013 7:04 pm
Sorry, you need to type the min and max of the random range.
Code: Select all
ReefAngel.WavemakerRandom1(Port5,10,60);
ReefAngel.WavemakerRandom2(Port6,25,90);
Roberto.
PreviousNext

Return to You and your tank

Who is online

Users browsing this forum: No registered users and 1 guest

cron