Page 1 of 1

Set WP40 to 0% during Feeding

Posted: Mon May 20, 2013 4:43 pm
by Sacohen
How can I set WP40 to 0% during feeding?

I'm using a Custom Wave mode that Roberto created

Code: Select all

byte MyCustomWave(byte maxspeed)
{
  static byte randomspeed=0;
  if (now()%11<5)
  {
    return randomspeed;
  }
  else if (now()%11>=5 && now()%11<10)
  {
    return maxspeed;
  }
  else
  {
    randomspeed=random(35,maxspeed);
    return 0;
  }
}
And call your function like this:

Code: Select all

  ReefAngel.PWM.SetActinic(MyCustomWave(70));

Re: Set WP40 to 0% during Feeding

Posted: Mon May 20, 2013 5:08 pm
by rimai
Try this:

Code: Select all

  ReefAngel.PWM.SetActinic(MyCustomWave(70));
  if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);

Re: Set WP40 to 0% during Feeding

Posted: Mon May 20, 2013 5:10 pm
by Sacohen
Thanks. As always.

Re: Set WP40 to 0% during Feeding

Posted: Tue May 21, 2013 8:40 am
by Sacohen
If I wanted the WP40 to go to 30% at night, when the light are off would the code go like this?
My lights are off between 10pm and 12pm.

Code: Select all

  ReefAngel.PWM.SetActinic(MyCustomWave(70));
  if( ReefAngel.DisplayedMenu==FEEDING_MODE ) ReefAngel.PWM.SetActinic(0);
  if (hour()<12 || hour()>=22) ReefAngel.PWM.SetActinic(30);
I am not at home and don't have the Reef Angel program installed at work so

I can't check the coding.

Re: Set WP40 to 0% during Feeding

Posted: Tue May 21, 2013 8:47 am
by rimai
You got it :)

Re: Set WP40 to 0% during Feeding

Posted: Tue May 21, 2013 8:58 am
by Sacohen
Cool, I figured out my first piece of coding?

I know it's not much, but it's a step in the right direction. :mrgreen:

Set WP40 to 0% during Feeding

Posted: Tue May 21, 2013 9:58 am
by binder
Sacohen wrote:Cool, I figured out my first piece of coding?

I know it's not much, but it's a step in the right direction. :mrgreen:
awesome. it is always a good feeling when you accomplish that and it works properly. :-)

Re: Set WP40 to 0% during Feeding

Posted: Tue May 21, 2013 10:12 am
by Sacohen
Thanks Curt.

I can't say it works properly yet, because I'm at work and have not updated the head unit yet, but if Robert says it will work, that's good enough for me.