New RA star | assign ports to different T*_PROBE

Do you have a question on how to do something.
Ask in here.

Posts: 8
Joined: Tue Nov 27, 2012 10:11 pm
PostPosted: Sat Jun 01, 2019 3:52 am
Hi there,

I just got my new RA star and wanted to try a few custom things. I went through the RA star wizard, read through the forum and had a go at the following custom commands.

1. turn off skimmer port if ATO high is active. I want the skimmer off if the water level rises too high - the float switch will be oriented with the wires up/coming out of the top.
2. control port 2 based on temps from T1_PROBE AND T2_PROBE
3. control port 8 based on temps from T3_PROBE

I am wondering if I have missed overriding anything from running the wizard.

Also, do I need to add anything to the code if I am going to connect this to a Netgear EX3700 wifi extender via ethernet cable?
I would really appreciate it if someone can look over the code for me.

Thanks in advance!

Michael.

Code: Select all
#include <Salinity.h>
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <RA_TS.h>
#include <RA_TouchLCD.h>
#include <RA_TFT.h>
#include <RA_TS.h>
#include <Font.h>
#include <RA_Wifi.h>
#include <RA_Wiznet5100.h>
#include <SD.h>
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetDHCP.h>
#include <PubSubClient.h>
#include <Wire.h>
#include <OneWire.h>
#include <Time.h>
#include <DS1307RTC.h>
#include <InternalEEPROM.h>
#include <RA_ATO.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 <RA_CustomLabels.h>
#include <RF.h>
#include <IO.h>
#include <ORP.h>
#include <AI.h>
#include <PH.h>
#include <WaterLevel.h>
#include <Humidity.h>
#include <PAR.h>
#include <DCPump.h>
#include <ReefAngel.h>
#include <SoftwareSerial.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.Star();
    ReefAngel.AddPHExpansion();  // pH Expansion Module
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = Port1Bit | Port4Bit;
    ReefAngel.FeedingModePortsE[1] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port4Bit;
    ReefAngel.WaterChangePortsE[1] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    ReefAngel.OverheatShutoffPortsE[0] = Port2Bit | Port5Bit | Port6Bit;
    ReefAngel.OverheatShutoffPortsE[1] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    ReefAngel.LightsOnPortsE[1] = 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( 275 );

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

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


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

void loop()
{
    ReefAngel.StandardHeater1( Box1_Port2 );
    ReefAngel.StandardFan1( Box1_Port3 );
    ReefAngel.Relay.DelayedOn( Box1_Port4 );
    ReefAngel.StandardLights( Box1_Port5 );
    ReefAngel.StandardLights( Box1_Port6 );
    ReefAngel.StandardLights( Box1_Port7 );
    ReefAngel.StandardHeater1( Box1_Port8 );

    boolean buzzer=false;
    if ( ReefAngel.isOverheat() ) buzzer=true;
    if ( buzzer ) ReefAngel.BuzzerOn(2); else ReefAngel.BuzzerOff();

    ////// Place your custom code below here


    ReefAngel.Relay.Set(Box1_Port4,!ReefAngel.HighATO.IsActive());
    if ReefAngel.Params.Temp[T1_PROBE]<249)) && ReefAngel.Params.Temp[T2_PROBE]<249)) ReefAngel.Relay.On( Box1_Port2 );
    if ReefAngel.Params.Temp[T1_PROBE]<253)) && ReefAngel.Params.Temp[T2_PROBE]<253)) ReefAngel.Relay.Off( Box1_Port2 );
    if ReefAngel.Params.Temp[T3_PROBE]<249)) ReefAngel.Relay.On( Box1_Port8 );
    if ReefAngel.Params.Temp[T3_PROBE]<253)) ReefAngel.Relay.Off( Box1_Port8 );



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

    ReefAngel.Network.Cloud();
    // This should always be the last line
    ReefAngel.ShowTouchInterface();
}



// RA_STRING1=U2FsdGVkX18dgbkr0enPhNXrgGcSxpffYBHcyfq7FfY=
// RA_STRING2=null
// RA_STRING3=null
// RA_LABEL LABEL_PORT27=Port 27
// RA_LABEL LABEL_PORT16=LightFrag
// RA_LABEL LABEL_ACTINIC2=Actinic 2
// RA_LABEL LABEL_PORT26=Port 26
// RA_LABEL LABEL_PORT15=LightFrag
// RA_LABEL LABEL_PORT24=Port 24
// RA_LABEL LABEL_PORT28=Port 28
// RA_LABEL LABEL_PORT23=Port 23
// RA_LABEL LABEL_PORT14=Skimmer
// RA_LABEL LABEL_PORT13=Fan
// RA_LABEL LABEL_PORT18=HeatFrag
// RA_LABEL LABEL_PORT22=Port 22
// RA_LABEL LABEL_PORT11=Return
// RA_LABEL LABEL_PORT25=Port 25
// RA_LABEL LABEL_DAYLIGHT2=Daylight 2
// RA_LABEL LABEL_PORT17=LightQT
// RA_LABEL LABEL_DAYLIGHT=Daylight
// RA_LABEL LABEL_PORT21=Port 21
// RA_LABEL LABEL_PORT12=HeatSump
// RA_LABEL LABEL_ACTINIC=Actinic
Image

Posts: 8
Joined: Tue Nov 27, 2012 10:11 pm
PostPosted: Sat Jun 01, 2019 4:44 pm
There were some issues with the custom code.
The following compiles, but I am still trying to work out the way to assign temp based functions for a port of 2 T*_PORTS.

Code: Select all
ReefAngel.Relay.Set(Box1_Port4,!ReefAngel.HighATO.IsActive());
    if (ReefAngel.Params.Temp[T1_PROBE]<249) ReefAngel.Relay.On( Box1_Port2 );
    if (ReefAngel.Params.Temp[T1_PROBE]>253) ReefAngel.Relay.Off( Box1_Port2 );
    if (ReefAngel.Params.Temp[T3_PROBE]<249) ReefAngel.Relay.On( Box1_Port8 );
    if (ReefAngel.Params.Temp[T3_PROBE]>253) ReefAngel.Relay.Off( Box1_Port8 );
Image

Posts: 12525
Joined: Fri Mar 18, 2011 6:47 pm
PostPosted: Sun Jun 02, 2019 9:08 pm
Try this:
Code: Select all
    if (ReefAngel.Params.Temp[T1_PROBE]<249 && ReefAngel.Params.Temp[T2_PROBE]<249) ReefAngel.Relay.On( Box1_Port2 );
    if (ReefAngel.Params.Temp[T1_PROBE]>253 && ReefAngel.Params.Temp[T2_PROBE]>253) ReefAngel.Relay.Off( Box1_Port2 );
Roberto.

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 2 guests

cron