I tried the following in the custom code section instead and it worked:
// kalk reactor
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off( Port7 ); //kalk dosing off 5pm-11pm
else ReefAngel.DosingPumpRepeat2( Port7 );
Reefology's code
Re: Reefology's code
Code: Select all
#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 <Salinity.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <PAR.h>
#include <ReefAngel.h>
////// Place global variable code below here
void SeasonalTemps ()
{
static int heatArray[][2] = { {780,784},// default in case of error in month=0 (May)
{764,768},//January (winter)
{768,772},//February (winter)
{772,776},//March (early spring)
{776,780},//April (spring)
{780,784},//May (spring)
{784,788},//June (early summer)
{788,792},//July (summer)
{784,788},//August (summer)
{780,784},//September (early fall)
{776,780},//October (fall)
{772,776},//November (fall)
{768,772} };//December (early winter)
ReefAngel.StandardHeater( Port1,heatArray[month()][0],heatArray[month()][1]);
}//end seasonalTemps
////// Place global variable code above here
void setup()
{
// This must be the first line
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port3Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port3Bit | Port4Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port5 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
SeasonalTemps();
ReefAngel.ActinicLights( Port3 ); //Skimmer
ReefAngel.DayLights( Port4 ); //ATS light
ReefAngel.DosingPumpRepeat1( Port6 );
//ReefAngel.DosingPumpRepeat2( Port7 );
ReefAngel.DosingPumpRepeat3( Port8 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
ReefAngel.DCPump.UseMemory = true;
ReefAngel.DCPump.LowATOChannel = Sync; // SW 8
ReefAngel.DCPump.HighATOChannel = AntiSync; // SW 8
//ReefAngel.DCPump.AntiSyncOffset = 125; // % (0-255) of main pump (Sync)
////// Place your custom code below here
// koralia 1150
// if (hour()>=23 || hour()<11) ReefAngel.Relay.Off( Port5 );
// else ReefAngel.WavemakerRandom( Port5, 120, 1800 );
// kalk reactor
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off( Port7 ); //kalk dosing off 5pm-11pm
else ReefAngel.DosingPumpRepeat2( Port7 );
// DC pumps
// To run this code must choose Custom in portal
static int rmode;
static boolean changeMode=true;
// These are the modes we can cycle through. You can add more and even repeat...
byte modes[] = { ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, LongPulse, Else, Gyre, NutrientTransport };
if (now()%3600==0 || changeMode==true) { // Change every 60 mins (3600seconds) or controller reboot
rmode=random(100)%sizeof(modes); // Change the mode by picking from our array
changeMode=false;
}
// Set timer when in feeding mode
static unsigned long feeding;
if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
// Continue NutrientTranspot Mode for 30 minutes after feeding
if (now()-feeding<1800) {
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Else;
ReefAngel.DCPump.Speed=80;
// Night mode (go to 30%)
} else if (now()%SECS_PER_DAY<39600 || now()%SECS_PER_DAY>=82800) { // 11pm to 11am
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Gyre;
ReefAngel.DCPump.Speed=40;
} else if (InternalMemory.DCPumpMode_read()==11) {
// Custom Mode and nothing else going on
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=modes[rmode]; // Put the mode to the random mode :)
ReefAngel.DCPump.Speed=InternalMemory.DCPumpSpeed_read(); // Set speed from portal
} else {
ReefAngel.DCPump.UseMemory=true; // Will reset all values from memory
}
////// Place your custom code above here
Re: Reefology's code
hey Roberto, wondering if this would work to turn off kalk reactor according to ph?
ReefAngel.PHControl( Port7 );
add this to the loop section and use it with the above code?
thanks
ReefAngel.PHControl( Port7 );
add this to the loop section and use it with the above code?
thanks
Re: Reefology's code
note to self: add something like this for my fish room fan.
if (ReefAngel.Params.Temp[T3_PROBE] >= 825) ReefAngel.Relay.On(Port6);
if (ReefAngel.Params.Temp[T3_PROBE] <= 805) ReefAngel.Relay.Off(Port6);
if (ReefAngel.Params.Temp[T3_PROBE] >= 825) ReefAngel.Relay.On(Port6);
if (ReefAngel.Params.Temp[T3_PROBE] <= 805) ReefAngel.Relay.Off(Port6);