Code to turn on Feeding mode ?

Do you have a question on how to do something.
Ask in here.
Post Reply
cjrudy
Posts: 135
Joined: Sat Nov 10, 2012 2:47 pm

Code to turn on Feeding mode ?

Post by cjrudy »

How would I code this to turn on feeding mode at a certain time, instead of using the app or portal.
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Code to turn on Feeding mode ?

Post 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;
}
}
cjrudy
Posts: 135
Joined: Sat Nov 10, 2012 2:47 pm

Re: Code to turn on Feeding mode ?

Post 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
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Code to turn on Feeding mode ?

Post 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.
cjrudy
Posts: 135
Joined: Sat Nov 10, 2012 2:47 pm

Re: Code to turn on Feeding mode ?

Post by cjrudy »

That worked perfect, thanks
User avatar
Sacohen
Posts: 1833
Joined: Sun Apr 21, 2013 6:25 am
Location: Davie, FL

Re: Code to turn on Feeding mode ?

Post by Sacohen »

No problem. Glad I could help.
Post Reply