Page 1 of 1

Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 2:02 pm
by cjrudy
How would I code this to turn on feeding mode at a certain time, instead of using the app or portal.

Re: Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 2:12 pm
by Sacohen
This is some code that will trigger a Ehiem Auto Feeder at 6pm and at the same time put the system in Feeding mode.

Maybe you can take something from this.

Code: Select all

static unsigned long feeding = 0;

if ((now()%SECS_PER_DAY==64800)) //if it is 6 pm
{
ReefAngel.FeedingModeStart(); //START FEEDING MODE
}

if (ReefAngel.DisplayedMenu==FEEDING_MODE)
{
if ( feeding == 0 ) {
feeding = now(); //set the time of the start of feeding to variable feeding
}

if ((now()-feeding>=60) && (now()-feeding<=61)) //if between 60 and 61 seconds has past
{
ReefAngel.Relay.On(Feeder); //TURN FEEDER RELAY ON
}
else 
{
ReefAngel.Relay.Off(Feeder); //TURN FEEDER RELAY OFF
}
} else {
if ( feeding > 0 ) {
feeding = 0;
}
}

Re: Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 2:27 pm
by cjrudy
ReefAngel.FeedingModeStart

Thats what I needed, do I need to tell it to go off or will it still go off after a certain time like it does now

Re: Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 3:11 pm
by Sacohen
I think the feeding will end after whatever duration you have set in the internal memory.

Mine is set for 900 seconds or 15 min.

Re: Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 5:02 pm
by cjrudy
That worked perfect, thanks

Re: Code to turn on Feeding mode ?

Posted: Thu Dec 26, 2013 6:21 pm
by Sacohen
No problem. Glad I could help.