using temp probes for other code.

Do you have a question on how to do something.
Ask in here.
Post Reply
Meshmez
Posts: 32
Joined: Fri May 11, 2012 2:44 pm

using temp probes for other code.

Post by Meshmez »

how do i use the reading of temp probe 2 in a "if" statement like:

if (tempprobe2 <= 760)
{
do something
}

and while im posting... will this work to have moonlights on from the end of standardlights until 3am? basically i want to have the moonlights go off at 3am.

if ( hour() >= 20 && hour () <= 3 )
{
ReefAngel.MoonLights(Port2); // Moonlights or Refugium
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: using temp probes for other code.

Post by rimai »

Code: Select all

if (ReefAngel.Params.Temp[T2_PROBE]<= 760)
No, && means and. You will never have an hour that is both >=20 and <=3.
You need to use ||, which means or.

Code: Select all

  if ( hour() >= 20 && hour () <= 3 )
  {
    ReefAngel.MoonLights(Port2); // Moonlights or Refugium
  }
  else
  {
    ReefAngel.Relay.Off(Port2);
  }
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: using temp probes for other code.

Post by rimai »

For your reference:
http://arduino.cc/en/Reference/HomePage
Look for Boolean Operators
Roberto.
Meshmez
Posts: 32
Joined: Fri May 11, 2012 2:44 pm

Re: using temp probes for other code.

Post by Meshmez »

awesome!

Thanks for both posts!
Post Reply