To activate Box2 in the code, do I need to do something special? I thought I would just be able to code for Box2_PortX and be done but for some reason the system won't activate any of Box2 ports. If I switch the dip switches on the universal relay to ID 2 and the power control expansion to ID 1 the opposite happens -- the PCE now works and the universal relay does not.
Is there something that needs to be added to the code?
Here is the code that I have right now with the Universal Relay as ID 1 and PCE as ID 2:
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>
/*
Ports assignment:
Port1 - Sump Heater
Port2 - Main Sump Pump
Port3 - Canopy Fan - Right
Port4 - Moon Lighting - Right
Port5 - Moon Lighting - Left
Port6 - Day Lights - Right
Port7 - Day Lights - Left
Port8 - Sun Lights - Left
Expansion Box 1 - Standard Expansion
Port1 - Stand Light
Port2 - Skimmer in Sump
Port3 - Canopy Fan - Left
Port4 - Circulation Pump - Tank Center
Port5 - Circulation Pump - Tank Right
Port6 - Circulation Pump - Tank Left
Port7 -
Port8 -
Expansion Box 2 - 12v Expansion
Port1 - ATO Pump
Port2 - Cal. Pump
Port3 - Mag. Pump
*/
void setup()
{
// This must be the first line
InternalMemory.LCDID_write(0);
ReefAngel.Init(); //Initialize controller
ReefAngel.Use2014Screen(); // Let's use 2014 Screen
ReefAngel.AddSalinityExpansion(); // Salinity Expansion Module
ReefAngel.AddWaterLevelExpansion(); // Water Level Expansion Module
ReefAngel.AddMultiChannelWaterLevelExpansion(); // Multi-Channel Water Level Expanion Module
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port2Bit;
ReefAngel.WaterChangePortsE[0] = Port2Bit | Port4Bit | Port5Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port6Bit | Port7Bit | Port8Bit;
ReefAngel.LightsOnPortsE[0] = 0;
ReefAngel.LightsOffPorts = Port4Bit | Port5Bit;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
ReefAngel.OverheatShutoffPortsE[0] = 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( 829 );
// Ports that are always on
ReefAngel.Relay.On( Port2 ); // Main Pump
ReefAngel.Relay.On( Box2_Port1 ); // Circulation Pump - Tank Center
ReefAngel.Relay.On( Box2_Port2 ); // Skimmer
ReefAngel.Relay.On( Box2_Port1 ); // Sump Lighting
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardHeater( Port1,751,801 );
ReefAngel.StandardFan( Port3,809,812 ); // Canopy Fan - Right
ReefAngel.StandardFan( Box2_Port3,809,812 ); // Canopy Fan - Left
ReefAngel.StandardLights( Port4,20,0,7,30 );
ReefAngel.StandardLights( Port5,20,0,7,30 );
ReefAngel.StandardLights( Port6,7,45,20,0 );
ReefAngel.StandardLights( Port7,7,50,19,30 );
ReefAngel.StandardLights( Port8,8,0,20,0 );
////// Place your custom code below here
if (ReefAngel.WaterLevel.GetLevel(1)<=90 && ReefAngel.WaterLevel.GetLevel(2)>10)ReefAngel.Relay.On(Box1_Port1);
if (ReefAngel.WaterLevel.GetLevel(1)>95)ReefAngel.Relay.Off(Box1_Port1);
ReefAngel.WavemakerRandom(Box2_Port5,60,300); // Turn Box2_Port5 on/off random cycles that lasts from 60 to 300 secs
if (ReefAngel.Water
ReefAngel.Relay.Set(Box2_Port6,!ReefAngel.Relay.Status(Box2_Port5)); // Turn Box2_Port6 on/off on opposite cycle as Box 1 - Port 5
////// Place your custom code above here
}