feed timer
-
Thavngr98
- Posts: 83
- Joined: Sun Jul 29, 2012 6:47 pm
- Location: Long Island, NY
feed timer
Can someone write me the code to daily
Turn feed mode on at 7:55
Turn feed mode off (turn everything back on) at 8:15
Turn feed mode on at 18:55
Turn feed mode off (turn everything back on) at 19:15
Turn feed mode on at 7:55
Turn feed mode off (turn everything back on) at 8:15
Turn feed mode on at 18:55
Turn feed mode off (turn everything back on) at 19:15
-Dave

-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: feed timer
Try this:
Code: Select all
#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_NokiaLCD.h>
#include <RA_ATO.h>
#include <RA_Joystick.h>
#include <LED.h>
#include <RA_TempSensor.h>
#include <Relay.h>
#include <RA_PWM.h>
#include <Timer.h>
#include <Memory.h>
#include <InternalEEPROM.h>
#include <RA_Colors.h>
#include <RA_CustomColors.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.Timer[FEEDING_TIMER].SetInterval(1200);
ReefAngel.FeedingModePorts = Port8Bit;
ReefAngel.Relay.On(Port8);
}
void loop()
{
if(hour()==7 && minute()==55 && second()==0) ReefAngel.FeedingModeStart();
if(hour()==18 && minute()==55 && second()==0) ReefAngel.FeedingModeStart();
ReefAngel.ShowInterface();
}
Roberto.
-
Thavngr98
- Posts: 83
- Joined: Sun Jul 29, 2012 6:47 pm
- Location: Long Island, NY
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: feed timer
That's fine.
Just change this:
To this:
Just change this:
Code: Select all
ReefAngel.FeedingModePorts = Port8Bit;
ReefAngel.Relay.On(Port8);
Code: Select all
ReefAngel.FeedingModePorts = Port1Bit | Port5Bit;
ReefAngel.Relay.On(Port1);
ReefAngel.Relay.On(Port5);
Roberto.
-
Thavngr98
- Posts: 83
- Joined: Sun Jul 29, 2012 6:47 pm
- Location: Long Island, NY
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: feed timer
Yes, but make sure you merge the two sections of the 3 custom sections.
The 1st section is for global variables declaration, which we did not use in this code.
The 2nd section is inside the setup() function and deals with initializing stuff and only happens once, which would be this:
And the 3rd is the section inside loop(), which is stuff the controller will do stuff and monitor, which would be this:
The 1st section is for global variables declaration, which we did not use in this code.
Code: Select all
////// Place global variable code below here
////// Place global variable code above here
Code: Select all
////// Place additional initialization code below here
ReefAngel.Timer[FEEDING_TIMER].SetInterval(1200);
ReefAngel.FeedingModePorts = Port1Bit | Port5Bit;
ReefAngel.Relay.On(Port1);
ReefAngel.Relay.On(Port5);
////// Place additional initialization code above here
Code: Select all
////// Place your custom code below here
if(hour()==7 && minute()==55 && second()==0) ReefAngel.FeedingModeStart();
if(hour()==18 && minute()==55 && second()==0) ReefAngel.FeedingModeStart();
////// Place your custom code above here
Roberto.
-
rimai
- Posts: 12857
- Joined: Fri Mar 18, 2011 6:47 pm
Re: feed timer
BTW, there is no harm if you placed everything in the 3rd section too...
You could have done that. The controller will do just the same thing in this case. Just for the point of view of code organization is we prefer to place the stuff where they should be and not simply bunch everything up in the same spot.
You could have done that. The controller will do just the same thing in this case. Just for the point of view of code organization is we prefer to place the stuff where they should be and not simply bunch everything up in the same spot.
Roberto.
-
kimacom
- Posts: 33
- Joined: Fri Jul 27, 2012 9:52 am
Re: feed timer
Great post.
i was looking for it.
thank you guys.
Tim
i was looking for it.
thank you guys.
Tim