Reefology's code
Re: Reefology's code
What do you want to do with them...if you want to speed one up or slow one down? Which is currently sync/antisync?
Re: Reefology's code
Yup, that's what I want. So do I remove the offset then? Leave it at 100? Or change it to some other figure?
Re: Reefology's code
I gave you two choices...you answered yup. If you want to speed up the antisync channel then make it 125 for a 25% increase. Or make it 75 for a 25% decrease on the one set to antisync
Re: Reefology's code
thanks for the info Lee
i answered "yup" because i'd like to know how to manipulate the fields/data going forward, don't just want to rely on you guys to write code for me (though at times i need you to and certainly do appreciate it). sorry for the confusion
i answered "yup" because i'd like to know how to manipulate the fields/data going forward, don't just want to rely on you guys to write code for me (though at times i need you to and certainly do appreciate it). sorry for the confusion
Re: Reefology's code
Hi all,
How do I figure out why I can't upload a sketch when it complies just fine?
This is the error message I'm getting:
avrdude: stk500v2_ReceiveMessage(): timeout
Same message I get when try to upload without cable. Can it be a cable issue? It seemed to work yesterday to upload wifitestcode? Sort of...
How do I figure out why I can't upload a sketch when it complies just fine?
This is the error message I'm getting:
avrdude: stk500v2_ReceiveMessage(): timeout
Same message I get when try to upload without cable. Can it be a cable issue? It seemed to work yesterday to upload wifitestcode? Sort of...
Re: Reefology's code
Make sure you are connecting the cable correctly on RA. It should be all the way to the right and you should have 2 pins unconnected on the left.
Roberto.
Re: Reefology's code
Hi Roberto,
Yes thanks, I've uploaded sketches many times so it's definitely not that. Any other ideas?
Yes thanks, I've uploaded sketches many times so it's definitely not that. Any other ideas?
Re: Reefology's code
Code: Select all
// 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[] = { NutrientTransport, Sine, ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, LongPulse, Else, Gyre, NutrientTransport };
if (now()%1200==0 || changeMode==true) { // Change every 20 (1200seconds) mins 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();
if (now()-feeding<3000) {
// Continue NutrientTranspot Mode for 45 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<37800 || now()%SECS_PER_DAY>=81000) { // 10:30am / 10:30pm
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Gyre;
ReefAngel.DCPump.Speed=30;
} 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
}
Re: Reefology's code
Code: Select all
// 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[] = { NutrientTransport, Sine, ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, LongPulse, Else, Gyre, NutrientTransport };
if (now()%1200==0 || changeMode==true) { // Change every 20 (1200seconds) mins 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();
if (now()-feeding<3000) {
// Continue NutrientTranspot Mode for 45 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<37800 || now()%SECS_PER_DAY>=81000) { // 10:30am / 10:30pm
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Gyre;
ReefAngel.DCPump.Speed=30;
} 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
}
Re: Reefology's code
Code: Select all
// 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[] = { NutrientTransport, Sine, ReefCrest, Lagoon, TidalSwell, ShortPulse, Sine, LongPulse, Else, Gyre, NutrientTransport };
if (now()%1200==0 || changeMode==true) { // Change every 20 (1200seconds) mins 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();
if (now()-feeding<3000) {
// Continue NutrientTranspot Mode for 45 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<37800 || now()%SECS_PER_DAY>=81000) { // 10:30am / 10:30pm
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Gyre;
ReefAngel.DCPump.Speed=30;
} 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
}
Re: Reefology's code
not sure which screen you're referring to but in the portal, the internal memory keeps getting reset to 0's for both speed and duration? currently the mode alternates but it was set up in custom??
Re: Reefology's code
The RA screen. Move the joystick to the right or left.
Or are you using a custom screen?
Or are you using a custom screen?
Roberto.
Re: Reefology's code
it says normal mode. what is that? don't see it listed in the portal as a mode.
Re: Reefology's code
Normal?
Are you sure you are in the RF screen?
Can you send a picture?
Are you sure you are in the RF screen?
Can you send a picture?
Roberto.
Re: Reefology's code
sorry Roberto, the mode is gyre, duration is 15 and speed is 30
Re: Reefology's code
lol, I just logged in to tell you i figured it out...had the actinic channel set to None and of course thought I had the pump wired to daylights :p
thanks Roberto
thanks Roberto
Re: Reefology's code
Code: Select all
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 = Port3Bit | Port4Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit;
// 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( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.ActinicLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.StandardLights( Port5, 19,0,7,0);
ReefAngel.DosingPumpRepeat1( Port6 );
ReefAngel.DosingPumpRepeat2( Port7 );
ReefAngel.DosingPumpRepeat3( Port8 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
ReefAngel.DCPump.LowATOChannel = Sync; // WP40
ReefAngel.DCPump.HighATOChannel = AntiSync; // SW 8
ReefAngel.DCPump.AntiSyncOffset=125;
////// Place your custom code below here
// 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=NutrientTransport;
ReefAngel.DCPump.Speed=80;
// Night mode (go to 30%)
} else if (now()%SECS_PER_DAY>25200 && now()%SECS_PER_DAY<=68400) { // 7am to 7pm
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Gyre;
ReefAngel.DCPump.Speed=30;
} 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
}
thanks
Code: Select all
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 = Port3Bit | Port4Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port7Bit;
// 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( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.ActinicLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.StandardLights( Port5 );
ReefAngel.DosingPumpRepeat1( Port6 );
ReefAngel.DosingPumpRepeat2( Port7 );
ReefAngel.DosingPumpRepeat3( Port8 );
ReefAngel.PWM.DaylightPWMParabola();
ReefAngel.PWM.ActinicPWMParabola();
ReefAngel.DCPump.LowATOChannel = Sync; // WP40 & SW 8
ReefAngel.DCPump.HighATOChannel = None; //
////// Place your custom code below here
// DC pumps....................................
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, Else, Gyre, NutrientTransport };
if (now()%1800==0 || changeMode==true) // Change every 30 mins (1800seconds) 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=ReefCrest;
ReefAngel.DCPump.Speed=80;
}
// Night/Quiet mode
else if (hour()>=2 && hour()<8 ) // 2am to 8am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Sine,35,10 );
}
else if (hour()>=15 && hour()<19) // 3pm and 7pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( LongPulse,30,1 );
}
//Storm mode
else if (hour()>=1 && hour()<2) // 1am and 2am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Else,80,15 );
}
else if (hour()>=11 && hour()<12) // 11am and 12pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( LongPulse,95,2 );
}
else if (hour()>=21 && hour()<22) // 9pm and 10pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ReefCrest,85,15 );
}
// Custom Mode and nothing else going on
else if (InternalMemory.DCPumpMode_read()==11)
{
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
Code: Select all
////// Place global variable code below here
////// Place global variable code above here
void setup()
{
// This must be the first line
InternalMemory.LCDID_write(255); //this line was added when i got a replacement RA+ board
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port5Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit;
// 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( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.ActinicLights( Port1 );
ReefAngel.DayLights( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.Relay.DelayedOn(Port5 );
ReefAngel.DosingPumpRepeat1( Port7 );
ReefAngel.DosingPumpRepeat2( Port8 );
ReefAngel.PWM.DaylightPWMSlope();
ReefAngel.PWM.ActinicPWMSlope();
ReefAngel.DCPump.LowATOChannel = Sync; // WP40
ReefAngel.DCPump.HighATOChannel = AntiSync; // SW-8
ReefAngel.DCPump.AntiSyncOffset = 125;
////// Place your custom code below here
// Wavemaker
if ( ((hour() >= 2) && (hour() < 8)) || ((hour() >= 15) && (hour() < 19)) ) // off from 2am-8am & 3pm-7pm
{
ReefAngel.Relay.Off(Port6);
}
else
{
ReefAngel.WavemakerRandom( Port6, 30, 300 ); // random between 30 and 300 seconds
}
// DC pumps....................................
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, Else, Gyre, NutrientTransport };
if (now()%1800==0 || changeMode==true) // Change every 30 mins (1800seconds) 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=ReefCrest;
ReefAngel.DCPump.Speed=75;
}
// Night/Quiet mode
else if (hour()>=2 && hour()<8 ) // 2am to 8am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Gyre,40,10 );
}
else if (hour()>=15 && hour()<19) // 3pm and 7pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ShortPulse,40,30 );
}
//Storm mode
else if (hour()>=1 && hour()<2) // 1am and 2am
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( Else,70,15 );
}
else if (hour()>=11 && hour()<12) // 11am and 12pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ReefCrest,80,15 );
}
else if (hour()>=21 && hour()<22) // 9pm and 10pm
{
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.SetMode( ShortPulse,85,30 );
}
// Custom Mode and nothing else going on
else if (InternalMemory.DCPumpMode_read()==11)
{
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
Hoping someone can help with this. I'd like to add Seasonal changes to my code but can't get it to compile.
where exactly do I input this?
Code: Select all
void SeasonalTemps ()
{
static int heatArray[][2] = { {782,786},// default in case of error in month=0 (June)
{760,764},//January (winter)
{764,768},//February (winter)
{765,769},//March (early spring)
{769,773},//April (spring)
{775,779},//May (spring)
{782,786},//June (early summer)
{789,793},//July (summer)
{796,800},//August (summer)
{786,790},//September (early fall)
{777,781},//October (fall)
{770,774},//November (fall)
{765,769} };//December (early winter)
ReefAngel.StandardHeater( Port3,heatArray[month()][0],heatArray[month()][1]);
}//end seasonalTemps
Re: Reefology's code
you have to simply copy the entire function and paste it into your INO file, most likely at the end of it. well after the last curly brace of the loop.
Sent from my XT1585 using Tapatalk
Sent from my XT1585 using Tapatalk
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 | Port2Bit | Port4Bit;
// 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( Port5 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
SeasonalTemps ();
ReefAngel.ActinicLights( Port2 ); //ATS pump
ReefAngel.DayLights( Port3 ); //ATS light
ReefAngel.StandardLights( Port4, 23,0,7,0); //Skimmer 11pm-7am
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 );
// 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
// This should always be the last line
}
Re: Reefology's code
Hoping someone from this great community can help as I'm not sure how to implement this. I'm looking to turn my kalk stirrer (port 7) off between 5pm and 11pm.
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off( Port7 );
if the statement above is correct, where should I input it into my code?
Thanks
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off( Port7 );
if the statement above is correct, where should I input it into my code?
Thanks
Re: Reefology's code
Hi Roberto,
so like this?
ReefAngel.DosingPumpRepeat1( Port6 );
ReefAngel.DosingPumpRepeat2( Port7 );
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off(Port7 );
ReefAngel.DosingPumpRepeat3( Port8 );
Thanks
so like this?
ReefAngel.DosingPumpRepeat1( Port6 );
ReefAngel.DosingPumpRepeat2( Port7 );
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off(Port7 );
ReefAngel.DosingPumpRepeat3( Port8 );
Thanks
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 );
if ( hour(now()) >= 17 && hour(now()) <= 23 ) ReefAngel.Relay.Off( Port7 ); //kalk dosing off 5pm-11pm
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 );
// 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, didnt work! any other ideas?