- 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 <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <DCPump.h>
#include <ReefAngel.h>
////// Place global variable code below here
////// 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
ReefAngel.AddSalinityExpansion(); // Salinity Expansion Module
ReefAngel.AddMultiChannelWaterLevelExpansion(); // Water Level Expansion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port4Bit | Port6Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port4Bit | Port6Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port3Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
ReefAngel.UseFlexiblePhCalibration();
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.ActinicChannel=Sync; // Now you're pump will be affected by the portal settings.
// Ports that are always on
ReefAngel.Relay.On( Port1 );
ReefAngel.Relay.On( Port6 );
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port3 );
ReefAngel.Relay.On( Box1_Port4 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port3 );
////// Place additional initialization code below here
//Use PH Flexible Calibration
ReefAngel.UseFlexiblePhCalibration();
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.Relay.DelayedOn( Port2 );
ReefAngel.StandardHeater( Port3 );
ReefAngel.WaterLevelATO( Port4 );
ReefAngel.Wavemaker1( Port5 );
ReefAngel.DayLights( Port8 );
ReefAngel.PWM.Channel0PWMSlope();
ReefAngel.PWM.Channel1PWMSlope();
ReefAngel.PWM.Channel2PWMSlope();
ReefAngel.PWM.Channel3PWMSlope();
ReefAngel.PWM.Channel4PWMSlope();
////// Place your custom code below here
// Add random mode if we set to Mode to 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, Constant, TidalSwell, ShortPulse, LongPulse, Else, Gyre };
if (now()%SECS_PER_DAY==0 || changeMode==true) { // Change at midnight or if controller rebooted
rmode=random(100)%sizeof(modes); // Change the mode once per day to pick 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<3600) {
// Continue NTM for the 60 minutes
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=NutrientTransport;
} else if (now()%SECS_PER_DAY<43200 || now()%SECS_PER_DAY>=79200) { // 12pm / 10pm
// Night mode (go to 30%)
ReefAngel.DCPump.UseMemory=false;
ReefAngel.DCPump.Duration=InternalMemory.DCPumpDuration_read();
ReefAngel.DCPump.Mode=Constant;
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
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.Portal( "ademster" );
ReefAngel.ShowInterface();
}
Sacohen's Current code
21 posts
• Page 2 of 3 • 1, 2, 3
here is the whole code.
Adam
58 Gal |
|
Here is the libraries version
Reef Angel Libraries Found: Development Reef Angel Libraries Version: 1.1.0 Adam
58 Gal |
|
This is for the developmental code (11).
For the currently released code (10) the original post that was in red will work. The part to remove would be the same part that is in blue. |
|
Still same error with
ElseMode Adam
58 Gal |
|
Are you using the the libraries that are part of the Arduino Controller or did you go to GitHub and download the dev libraries from there (https://github.com/reefangel/Libraries/archive/dev.zip)?
|
|
part of arduino, didn't know I had to download from github..
NVM, i figuired it out Adam
58 Gal |
|
You don't have to download the dev files.
You are either using the currently released version the Roberto had tweaked, approved and release or you are using a beta version that people are adding things to and making adjustments. Glad you got it working. Please post what you did to get it working so others can benefit from it. |
|
sorry steve couldn't find it, but what valve did you use to flush your ro/di? |
|
I got a 1/2" Normally Closed Pneumatic Plastic Air Water Electric Solenoid Valve 12V DC off Ebay (http://www.ebay.com/itm/1-2-Inch-Normal ... 1c4fff435f) plumbed it into my line that feeds my RO/Di system and then plugged it into my RANet Relay in the garage.
I got the 12v version because I was originally going to run Cat 5 wir back to my 12v Power Expansion module and running from there, but I had problems with the power expansion module and when Roberto released the RANet Relay I got that instead. The valve is just running ordinary house water thru it so you don't need to worry about it being OK for salt water and corrosion. This is the code I'm using to turning on 3 days a week for 5 min at 9PM.
I'm trying to figure out how to get it to run Monday, Wednesday and Friday rather than every 3 days. Roberto gave me this for 3 specific days, but it didn't seems to work.
I'm not real good at coding so I can't figure out why it wasn't working. |
|
is there a way to have a random mode from, lets say, 10 am to 6 pm and then run a set mode over night?
|
|
21 posts
• Page 2 of 3 • 1, 2, 3
Who is online
Users browsing this forum: No registered users and 1 guest