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 <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.AddStandardMenu(); // Add Standard Menu
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 869 );
// Ports that are always on
ReefAngel.Relay.On( Port3 );
ReefAngel.Relay.On( Port4 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardFan( Port1,771,781 );
ReefAngel.StandardHeater( Port2,751,761 );
ReefAngel.DosingPumpRepeat( Port5,0,240,120 );
ReefAngel.Wavemaker( Port6,60 );
ReefAngel.StandardLights( Port7,9,0,19,0 );
ReefAngel.StandardLights( Port8,9,0,19,0 );
ReefAngel.DosingPumpRepeat( Box1_Port1,0,360,120 );
ReefAngel.DosingPumpRepeat( Box1_Port2,60,360,120 );
ReefAngel.SingleATO( true,Box1_Port3,60,0 );
ReefAngel.PWM.SetDaylight( PWMSlope(9,0,20,0,0,100,60,15) );
ReefAngel.PWM.SetActinic( PWMSlope(9,0,20,0,0,100,60,15) );
////// Place your custom code below here
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
The first part:
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 <ReefAngel.h>
Next part:
Code: Select all
////// Place global variable code below here
////// Place global variable code above here
Another way to comment is like this:
Code: Select all
/* These symbols
Make Comments
Out of Everything
Between Them.
*/
Code: Select all
void setup()
void means that when we call this function, we don't expect it to tell us anything back. It's a little out of place here since we never really call setup, it is automatically run once when the program starts up. The empty () means we aren't sending any data to it. Again, kind of extra in this case.
Next, we have {. This starts a section of code. In this case, it's the beginning of setup(). Every function will have a { at the beginning and a } at the end. In addition, you may have other sets of these inside the function. An "if" statement is a good example of this. Again, they just define a section of the code.
Code: Select all
ReefAngel.Init(); //Initialize controller
Code: Select all
ReefAngel.AddStandardMenu(); // Add Standard Menu
Code: Select all
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit;
Code: Select all
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = 0;
Code: Select all
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
Please note that everything is CaSe SeNsItIvE! T1_PROBE is not the same as t1_probe. Capitalization is important.
Code: Select all
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 869 );
A note on function names. You can name functions just about anything you like. Writers will use "." and "_" as part of the function name. The "." is used to denote different functions in a group. Like ReefAngel.TempProbe and ReefAngel.OverheatProbe, both parts of the ReefAngel group. The "_" is used intstead of spaces, which are not allowed.
Code: Select all
// Ports that are always on
ReefAngel.Relay.On( Port3 );
ReefAngel.Relay.On( Port4 );
Finally,
Code: Select all
////// Place additional initialization code below here
////// Place additional initialization code above here
}
Part 2 to follow.
--Colin