Guys,
I'm going in vacation for a week. Please help me with an automatic feeding mode program.
I have an eheim feeder programmed for 9am and 6pm.
If possible, I'd like RA to enable the feeding mode at 8:55am and 5:55pm.
Here is my current Ragen generated program:
###INTERNAL MEMORY###
"// Autogenerated file by RAGen (v1.1.0.127), (12/06/2011 10:01)
// Memory_120611_1001.pde
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <Phillips6610LCDInv.h>
#include <avr/pgmspace.h>
#include <ReefAngel_EEPROM.h>
Phillips6610LCDInv e;
void setup()
{
e.lcd_init();
e.lcd_clear(COLOR_WHITE,0,0,132,132);
e.lcd_BacklightOn();
InternalMemory.MHOnHour_write(11);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(21);
InternalMemory.MHOffMinute_write(0);
InternalMemory.MHDelay_write(5);
InternalMemory.StdLightsOnHour_write(5);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(0);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.DP1RepeatInterval_write(60);
InternalMemory.DP2RepeatInterval_write(60);
InternalMemory.ATOTimeout_write(60);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.LEDPWMActinic_write(50);
InternalMemory.LEDPWMDaylight_write(50);
InternalMemory.WM1Timer_write(0);
InternalMemory.WM2Timer_write(0);
InternalMemory.HeaterTempOn_write(780);
InternalMemory.HeaterTempOff_write(791);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.OverheatTemp_write(1500);
InternalMemory.PHMax_write(840);
InternalMemory.PHMin_write(550);
}
void loop()
{
// display the values
char buf[128];
sprintf(buf, "MH %2d:%02d-%2d:%02d,%d", InternalMemory.MHOnHour_read(), InternalMemory.MHOnMinute_read(),
InternalMemory.MHOffHour_read(), InternalMemory.MHOffMinute_read(),
InternalMemory.MHDelay_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
sprintf(buf, "Std %2d:%02d-%2d:%02d", InternalMemory.StdLightsOnHour_read(), InternalMemory.StdLightsOnMinute_read(),
InternalMemory.StdLightsOffHour_read(), InternalMemory.StdLightsOffMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
sprintf(buf, "LED A: %d%% D: %d%%", InternalMemory.LEDPWMActinic_read(), InternalMemory.LEDPWMDaylight_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
sprintf(buf, "WM1: %ds", InternalMemory.WM1Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, buf);
sprintf(buf, "WM2: %ds", InternalMemory.WM2Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
sprintf(buf, "F: %ds", InternalMemory.FeedingTimer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
sprintf(buf, "S: %ds", InternalMemory.LCDTimer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
sprintf(buf, "H On: %d -> %d", InternalMemory.HeaterTempOn_read(), InternalMemory.HeaterTempOff_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*9, buf);
sprintf(buf, "C On: %d -> %d", InternalMemory.ChillerTempOn_read(), InternalMemory.ChillerTempOff_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*10, buf);
sprintf(buf, "PH %d - %d", InternalMemory.PHMax_read(), InternalMemory.PHMin_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*11, buf);
delay(10000);
e.lcd_clear(COLOR_WHITE,0,0,132,132);
sprintf(buf, "OH: %dF", InternalMemory.OverheatTemp_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
sprintf(buf, "ATO L: %ds (%dh)", InternalMemory.ATOTimeout_read(), InternalMemory.ATOHourInterval_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
sprintf(buf, "ATO H: %ds (%dh)", InternalMemory.ATOHighTimeout_read(), InternalMemory.ATOHighHourInterval_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
sprintf(buf, "DP1: %2d:%02d", InternalMemory.DP1OnHour_read(), InternalMemory.DP1OnMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
sprintf(buf, " %ds", InternalMemory.DP1Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
sprintf(buf, "DP2: %2d:%02d", InternalMemory.DP2OnHour_read(), InternalMemory.DP2OnMinute_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
sprintf(buf, " %ds", InternalMemory.DP2Timer_read());
e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*8, buf);
delay(10000);
e.lcd_clear(COLOR_WHITE,0,0,132,132);
}
###MAIN###
// Autogenerated file by RAGen (v1.1.0.127), (12/11/2011 20:51)
// RA_121111_2051.pde
//
// This version designed for v0.8.5 Beta 17 or later
/* The following features are enabled for this PDE File:
#define DisplayImages
#define DateTimeSetup
#define VersionMenu
#define DirectTempSensor
#define DisplayLEDPWM
#define SIMPLE_MENU
#define CUSTOM_MAIN
#define ENABLE_ATO_LOGGING
#define ENABLE_EXCEED_FLAGS
*/
#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <ReefAngel_Wifi.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <ReefAngel_EEPROM.h>
#include <ReefAngel_NokiaLCD.h>
#include <ReefAngel_ATO.h>
#include <ReefAngel_Joystick.h>
#include <ReefAngel_LED.h>
#include <ReefAngel_TempSensor.h>
#include <ReefAngel_Relay.h>
#include <ReefAngel_PWM.h>
#include <ReefAngel_Timer.h>
#include <ReefAngel_Memory.h>
#include <ReefAngel.h>
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 112);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 93, TempRelay);
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph(5, 5);
}
void setup()
{
ReefAngel.Init(); //Initialize controller
// Ports that are always on
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port5);
ReefAngel.Relay.On(Port8);
}
void loop()
{
// Specific functions
ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.MHLights(Port3);
ReefAngel.StandardFan(Port6);
ReefAngel.StandardHeater(Port7);
ReefAngel.ShowInterface();
}
feeding schedule
Re: feeding schedule
You should be able to just at this to your loop()
This will start the feeding mode only when the specified time occurs. The reason why we add the second()==0 check is so it's not run/started every second during that minute. I also combined both the morning and night checks for the hour as well.
The condition checks if the (Hour is 8 OR 6) AND (Minute is 55) AND (Seconds is 0). If all those evaluate to true, then it starts the feeding mode.
The resulting code will look something like this:
I'm testing it right now and so far it's working as expected. It's doing the feeding mode countdown for me.
Give it a try and see how it works for you.
curt
Code: Select all
// if the hour is 8a or 6p, minute is 55 and seconds is 0
// start the feeding mode
if ( ((hour() == 8) || (hour() == 18)) &&
(minute() == 55) &&
(second() == 0) ) {
ReefAngel.FeedingModeStart();
}
The condition checks if the (Hour is 8 OR 6) AND (Minute is 55) AND (Seconds is 0). If all those evaluate to true, then it starts the feeding mode.
The resulting code will look something like this:
Code: Select all
void loop()
{
// Specific functions
ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.MHLights(Port3);
ReefAngel.StandardFan(Port6);
ReefAngel.StandardHeater(Port7);
// if the hour is 8a or 6p, minute is 55 and seconds is 0
// start the feeding mode
if ( ((hour() == 8) || (hour() == 18)) &&
(minute() == 55) &&
(second() == 0) )
{
ReefAngel.FeedingModeStart();
}
ReefAngel.ShowInterface();
}
Give it a try and see how it works for you.
curt
Re: feeding schedule
These 2 items are currently not doing anything useful for you. You do not have any code that will display the indicators. The exceed flags can be used with the custom main. The ato logging is primarily for use with an external application. Since you don't have the wifi defined, this is just taking up some space (~200K or so).Code: Select all
#define ENABLE_ATO_LOGGING #define ENABLE_EXCEED_FLAGS
You can save yourself some code space if you remove them. However, if you plan on using them in the future then you can leave them in.
Just thought I'd make a comment about them.
curt
Re: feeding schedule
Thanks Curt, it's working great. I appreciate it.
Re: feeding schedule
cool. glad it's working for you.d0lph1n wrote:Thanks Curt, it's working great. I appreciate it.
curt