Stuck with the I/O port #2 - ATO.
At this stage the waterlevel is high, so the I/O port#2 is ON, and I don't know how to code ATO OFF.
when the I/O#2 is OFF (low waterlevel) to turn the ATO ON with timer let say 60 second.
How to do this work around? Thanks in advance.........
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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature
ReefAngel.AddStandardMenu(); // Add Standard Menu
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port8Bit;
// 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( 265 );
// Ports that are always on
ReefAngel.Relay.On( Port7 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1,62 );
ReefAngel.StandardHeater( Port2,240,255 );
ReefAngel.StandardLights( Port3,8,55,20,5 );
ReefAngel.StandardLights( Port4,11,5,15,55 );
if (hour()>=9 && hour()<20)
{
ReefAngel.Wavemaker( Port5,5 );
ReefAngel.Relay.Set(Port6,!ReefAngel.Relay.Status(Port5));
}
else
{
ReefAngel.Relay.Off(Port5);
ReefAngel.Relay.Off(Port6);
}
ReefAngel.PWM.SetChannel( 0, PWMParabola(9,5,19,55,15,100,15) );
ReefAngel.PWM.SetChannel( 1, PWMParabola(10,5,18,55,15,100,15) );
ReefAngel.PWM.SetChannel( 2, PWMParabola(11,5,15,55,15,100,15) );
ReefAngel.PWM.SetChannel( 3, PWMParabola(11,35,17,55,15,100,15) );
ReefAngel.PWM.SetChannel( 4, PWMParabola(18,35,3,5,15,100,15) );
////// Place your custom code below here
//Float #1
if (ReefAngel.IO.GetChannel(1)) // if float 1 is triggered
{
ReefAngel.Relay.Off(Port8); // Turn Return off
ReefAngel.Relay.Off(Port7); // Turn Skimmer off
BuzzerOn(); // Turn Buzzer on
}
//Float #2
if (ReefAngel.IO.GetChannel(2)) // if float 2 is triggered
{
ReefAngel.Relay.On(Port1); // Turn AutoTopOff on
ReefAngel.Timer[1].Start(); // Start/Trigger timer
}
// Float #3
if (ReefAngel.IO.GetChannel(3)) // if float 3 is triggered
BuzzerOn(); // Turn Buzzer on
// Float #4
// if (ReefAngel.IO.GetChannel(4)) // if float 4 is triggered
// ReefAngel.Relay.On(Port7); // Turn Skimmer off
// Float #5
// if (ReefAngel.IO.GetChannel(5)) // if float 5 is triggered
{
// ReefAngel.Relay.Off(Port8); // Turn Return off
// BuzzerOn(); // Turn Buzzer on
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Dimming Expansion
x = 15;
y = 2;
for ( int a=0;a<6;a++ )
{
if ( a>2 ) x = 75;
if ( a==3 ) y = 2;
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x,y,"Ch :" );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+12,y,a );
ReefAngel.LCD.DrawText( COLOR_DARKGOLDENROD,DefaultBGColor,x+24,y,ReefAngel.PWM.GetChannelValue(a) );
y += 10;
}
pingSerial();
// I/O Expansion
byte bkcolor;
x = 14;
y = 39;
for ( int a=0;a<6;a++ )
{
ReefAngel.LCD.DrawCircleOutline( x+(a*20),y,4,COLOR_MEDIUMORCHID );
if ( ReefAngel.IO.GetChannel(a) ) bkcolor=COLOR_WHITE;
else bkcolor=COLOR_GRAY;
ReefAngel.LCD.FillCircle( x+(a*20),y,2,bkcolor );
}
pingSerial();
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 53, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 90, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
}
void BuzzerOn()
{
ReefAngel.PWM.SetActinic((now()%2)*100);
}