Dual PH Setup & Code

Basic / Standard Reef Angel hardware
Post Reply
Lockes
Posts: 31
Joined: Fri Jul 20, 2012 4:04 am

Dual PH Setup & Code

Post by Lockes »

Hey all

I have two ph probes

Probe 1 (currently installed) is for my main tank reading
Probe 2 is for the CO2 solenoid valve / reactor setup

Probe 2 will switch a plug on/off as per the standard co2 settings on Ragen

I want Probe 1 to also switch off that particular plug if the ph falls below 7.9

How do I do this?

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 <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 38, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 42, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 53, 50, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // 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( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.CO2Control( Port6,752,748 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "Lockes" );
    ReefAngel.ShowInterface();
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dual PH Setup & Code

Post by rimai »

Use this:

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 <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 38, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 42, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 53, 50, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // 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( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

    ////// Place additional initialization code below here
    

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    if (ReefAngel.Params.PHExp <= 748) Relay.Off(Port6);  // If probe 2 PH <= 7.48 - turn off CO2
    if (ReefAngel.Params.PHExp >= 752) Relay.On(Port6);  // If probe 2 PH >= 7.52 - turn on CO2    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If PH <= LowPH - turn off CO2
    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If probe 1 PH <= 7.90 - turn off CO2
    

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "Lockes" );
    ReefAngel.ShowInterface();
}
Roberto.
Lockes
Posts: 31
Joined: Fri Jul 20, 2012 4:04 am

Re: Dual PH Setup & Code

Post by Lockes »

Thank you for your reply

I am still awaiting my ph expansion so have not yet tried this

Just to confirm will the plug switch on once it raises again?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dual PH Setup & Code

Post by rimai »

yes
Roberto.
Lockes
Posts: 31
Joined: Fri Jul 20, 2012 4:04 am

Re: Dual PH Setup & Code

Post by Lockes »

I am getting an error unfortunately

'Relay' was not declared in this scope

And it highlights - if (ReefAngel.Params.PHExp <= 735) Relay.Off(Port6); // If probe 2 PH <= 7.35 - turn off CO2

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 <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 38, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 42, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 53, 50, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // 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( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

    ////// Place additional initialization code below here
   

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    if (ReefAngel.Params.PHExp <= 735) Relay.Off(Port6);  // If probe 2 PH <= 7.35 - turn off CO2
    if (ReefAngel.Params.PHExp >= 752) Relay.On(Port6);  // If probe 2 PH >= 7.52 - turn on CO2    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If PH <= LowPH - turn off CO2
    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If probe 1 PH <= 7.90 - turn off CO2
   

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "Lockes" );
    ReefAngel.ShowInterface();
}
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Dual PH Setup & Code

Post by lnevo »

Change Relay.Off to ReefAngel.Relay.Off in that line.
Lockes
Posts: 31
Joined: Fri Jul 20, 2012 4:04 am

Re: Dual PH Setup & Code

Post by Lockes »

Thanks but got another

In file included from sketch_sep16a.cpp:26:
C:\Users\Andrew\Documents\Arduino\libraries\ReefAngel/ReefAngel.h:109: error: 'PHClass' does not name a type

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 <ReefAngel.h>

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 38, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 42, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 53, 50, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // 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( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

    ////// Place additional initialization code below here
   

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    if (ReefAngel.Params.PHExp <= 735) ReefAngel.Relay.Off(Port6);  // If probe 2 PH <= 7.35 - turn off CO2
    if (ReefAngel.Params.PHExp >= 752) ReefAngel.Relay.On(Port6);  // If probe 2 PH >= 7.52 - turn on CO2    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If PH <= LowPH - turn off CO2
    if (ReefAngel.Params.PH <= 790) ReefAngel.Relay.Off(Port6);  // If probe 1 PH <= 7.90 - turn off CO2
   

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "Lockes" );
    ReefAngel.ShowInterface();
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dual PH Setup & Code

Post by rimai »

Add this to the include section:

Code: Select all

#include <PH.h>
Roberto.
Lockes
Posts: 31
Joined: Fri Jul 20, 2012 4:04 am

Re: Dual PH Setup & Code

Post by Lockes »

Thanks for all the help and sorry for yet another question

Now it's too big unfortunately.

All I need is
2 X PH
2 X temp
1 X ATO
Wifi

Cannot seem to see what else I can exclude

Simple Menu
Binary sketch size: 33,150 bytes (of a 32,256 byte maximum)
processing.app.debug.RunnerException: Sketch too big; see http://www.arduino.cc/en/Guide/Troubleshooting#size for tips on reducing it.
at processing.app.Sketch.size(Sketch.java:1844)
at processing.app.Sketch.build(Sketch.java:1775)
at processing.app.Sketch.build(Sketch.java:1750)
at processing.app.Editor$DefaultRunHandler.run(Editor.java:1867)
at java.lang.Thread.run(Thread.java:619)

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 <AI.h>
#include <ReefAngel.h>
#include <PH.h>

////// Place global variable code below here


////// Place global variable code above here

void DrawCustomMain()
{
// the graph is drawn/updated when we exit the main menu &
// when the parameters are saved
ReefAngel.LCD.DrawDate(6, 64);
ReefAngel.LCD.DrawLargeText(COLOR_DARKTURQUOISE, COLOR_WHITE, 19, 4 , "BOBS REEF");
ReefAngel.LCD.Clear(COLOR_MAROON, 1, 13, 132, 13);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 75, 119, 75);
ReefAngel.LCD.Clear(COLOR_MAROON, 10, 59, 119, 59);
pingSerial();


ReefAngel.LCD.DrawLargeText(COLOR_GOLDENROD, COLOR_WHITE, 33, 15, "Tank Water");
char text[7];
ConvertNumToString(text, ReefAngel.Params.Temp[T1_PROBE], 10);
pingSerial();
ReefAngel.LCD.DrawHugeText(COLOR_GOLDENROD, DefaultBGColor, 38, 26, text);

ReefAngel.LCD.DrawLargeText(COLOR_MEDIUMSEAGREEN, COLOR_WHITE, 60, 42, "pH");
ConvertNumToString(text, ReefAngel.Params.PH, 100);

ReefAngel.LCD.DrawLargeText(PHColor, DefaultBGColor, 53, 50, text);
pingSerial();

ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,84,"ATO");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,94,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,104,"CO2");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,10,114,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,84,"Return");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,94,"Vortech");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,104,"N/A");
ReefAngel.LCD.DrawText(COLOR_MEDIUMSEAGREEN,DefaultBGColor,80,114,"Heater");
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawCircleOutletBox(60, 86, TempRelay, true);
}

void DrawCustomGraph()
{

}

void setup()
{
    // This must be the first line
    ReefAngel.Init();  //Initialize controller
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature

    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    // 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( 260 );


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );

    ////// Place additional initialization code below here
   

    ////// Place additional initialization code above here
}

void loop()
{
    ReefAngel.SingleATO( true,Port2,60,0 );
    ReefAngel.StandardLights( Port3,4,0,23,0 );
    ReefAngel.StandardHeater( Port7,250,255 );
    ////// Place your custom code below here
    if (ReefAngel.Params.PHExp <= 735) ReefAngel.Relay.Off(Port6);  // If probe 2 PH <= 7.35 - turn off CO2
    if (ReefAngel.Params.PHExp >= 752) ReefAngel.Relay.On(Port6);  // If probe 2 PH >= 7.52 - turn on CO2    if (ReefAngel.Params.PH <= 790) Relay.Off(Port6);  // If PH <= LowPH - turn off CO2
    if (ReefAngel.Params.PH <= 790) ReefAngel.Relay.Off(Port6);  // If probe 1 PH <= 7.90 - turn off CO2
   

    ////// Place your custom code above here

    // This should always be the last line
    ReefAngel.Portal( "Lockes" );
    ReefAngel.ShowInterface();
}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dual PH Setup & Code

Post by rimai »

You will need to remove the large fonts you are using in your code.
Roberto.
Post Reply