1. For some reason my relay port 2 always turns itself off. It doesn't do it right away it seems to be a random time but after a day or 2 I will look at my controls and port 2 will be manually turned off. Easy enough just turn it back on right? Well when I turn it back on it instantly turns it back off. Nothing in my code even touches port 2.
2. Randomly things just wont listen to me. I connect to my reef angel via my android and I will manually turn off the return and it appears to send the signal over but it doesn't actually turn the pump off. When it starts doing this I have to unplug the whole system for like 3 seconds and plug it back in. Then everything starts to listen to commands again.
Does anyone have any ideas on these two issues? They are driving me crazy
Here is my code. I've gone through it countless times and I can't find any issues with it. =/
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 <ReefAngel.h>
void setup(){
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port8Bit;
//Always on
ReefAngel.Relay.On(Port2);
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port7); //Sump Light
ReefAngel.Relay.On(Port8); //Sump Powerhead
//Set timer for powerhead 1
ReefAngel.Timer[1].SetInterval(random(15,60));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port5);
//Set timer for powerhead 2
ReefAngel.Timer[2].SetInterval(random(5,10));
ReefAngel.Timer[2].Start();
}
void loop(){
ReefAngel.Portal("dmglakewood");
ReefAngel.ShowInterface();
//Random powerhead turn on
if(ReefAngel.Timer[1].IsTriggered()){
ReefAngel.Timer[1].SetInterval(random(15,60));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port5);
}
//Power head 2 random short time
if(ReefAngel.Timer[2].IsTriggered()){
ReefAngel.Timer[2].SetInterval(random(5,10));
ReefAngel.Timer[2].Start();
ReefAngel.Relay.Toggle(Port6);
}
//Heater on when temp lower then 80.0F
if(ReefAngel.Params.Temp[T1_PROBE] < 790 && ReefAngel.Params.Temp[T1_PROBE] > 0){
ReefAngel.Relay.On(Port1);
} else if(ReefAngel.Params.Temp[T1_PROBE] >= 800){
ReefAngel.Relay.Off(Port1);
}
//Turn sump light on at 9am and turn off at 9pm
if(hour() >= 9 && hour() < 21){
ReefAngel.Relay.On(Port7);
} else {
ReefAngel.Relay.Off(Port7);
}
//ATO Sump too low
if(!ReefAngel.LowATO.IsActive() && ReefAngel.HighATO.IsActive()){
//Water in sump too low, let's pump some in
ReefAngel.Relay.On(Port4);
}
//ATO Sump good level
if(ReefAngel.LowATO.IsActive() || !ReefAngel.HighATO.IsActive()){
//Water in sump too low, let's pump some in
ReefAngel.Relay.Off(Port4);
}
}