Here are the problems I'm having. I'm basing my sketch on the CustomMainScreen_RelayExpansion.....to get my second relay working. I can see it in the Reef Angel client v2.2, and control it, however the outlet configuration is what's puzzling me. I see no specifics for the second relay box in the sketch. Should they be there, and what would be the proper code to define them as "on" for now.
My next question is with the PH probe. Having never used one before, if I upload a new sketch after calibrating, do I need to calibrate again, or is that that something that stays set.
3rd is I', having trouble with the MHlights toggling on and off. The port always sits in the off state, never turning on. I can toggle the port via the client, but it doesn't work automatically. Standard Lights work just fine.
Thanks!!!
Scott
Sketch
Code: Select all
#include <Salinity.h>
#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 <RF.h>
#include <IO.h>
#include <ORP.h>
#include <ReefAngel.h>
byte x,y;
char text[10];
void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 122);
pingSerial();
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue());
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor(15, 60, ReefAngel.Params);
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox(12, 92, TempRelay);
pingSerial();
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox(12, 104, TempRelay);
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph(5, 5);
}
/*
For more information about custom main screen: http://forum.reefangel.com/viewtopic.php?f=14&t=109
To be able to use the custom main screen and salinity, please make sure that you enabled custom main screen and relay expansion on your features file.
Open RAGen and make sure you have Custom Main Screen and Relay Expansion checked under the Features tab.
Or, you can manually edit the file.
The file is located at "Documents\Arduino\libraries\ReefAngel_Features.h" file and has to include this line in it:
#define CUSTOM_MAIN
#define RelayExp
*/
void setup()
{
ReefAngel.Init(); //Initialize controller
ReefAngel.FeedingModePorts = 0;
ReefAngel.WaterChangePorts = 0;
ReefAngel.OverheatShutoffPorts = 0;
ReefAngel.LightsOnPorts = 0;
// Ports that are always on
ReefAngel.Relay.On(Port2);
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port4);
ReefAngel.Relay.On(Port6);
}
void loop()
{
// Specific functions
ReefAngel.StandardLights(Port1);
ReefAngel.StandardLights(Port5);
ReefAngel.StandardLights(Port7);
ReefAngel.MHLights(Port8);
ReefAngel.Portal("neogenesis", "***********");
ReefAngel.ShowInterface();
}