A few thing wizard did wrong, how to code it

Do you have a question on how to do something.
Ask in here.
Post Reply
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

A few thing wizard did wrong, how to code it

Post by symon_say »

Hi

I set al my codes with the web wizard, but some things are not working properly.

• UV in port 13 is suppose to be always on, and turn of if port 11 is off, but is off and tier to port 3.

• Wavemaker was set to 3600-7400 sec random in port 6, and opposite in port 16, but is turning like every 30 sec.

• Fuge light is set on timer for 10:00 PM to 12:00 AM, but is always on.

• Temp 2 is set to F when all the others are C.

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 <Humidity.h>
#include <DCPump.h>
#include <PAR.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.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    ReefAngel.FeedingModePortsE[1] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port5Bit;
    ReefAngel.WaterChangePortsE[0] = Port5Bit;
    ReefAngel.WaterChangePortsE[1] = Port1Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port3Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[1] = Port1Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    ReefAngel.LightsOnPortsE[1] = 0;
    // Use T3 probe as temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T3_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 300 );

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Box1_Port4 );

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


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

void loop()
{
    ReefAngel.Relay.DelayedOn( Port3 );
    ReefAngel.Relay.DelayedOn( Box1_Port3 );
    ReefAngel.WaterLevelATO( Box1_Port5 );
    ReefAngel.DosingPumpRepeat1( Port5 );
    ReefAngel.Wavemaker2( Port6 );
    ReefAngel.Relay.Set( Box1_Port6, !ReefAngel.Relay.Status( Port6 ) );
    ReefAngel.StandardLights( Box1_Port7 );
    ReefAngel.StandardFan3( Port7 );
    if ( ReefAngel.Relay.Status( Port3 ) ) ReefAngel.Relay.Off( Box1_Port3 );

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


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

    ReefAngel.Portal( "symon_say" );
    // This should always be the last line
    ReefAngel.ShowInterface();
}



// RA_STRING1=null
// RA_STRING2=null
// RA_STRING3=null
// RA_LABEL LABEL_PORT8=N/A
// RA_LABEL LABEL_PORT27=N/A
// RA_LABEL LABEL_PORT2=Sump Led
// RA_LABEL LABEL_PORT16=Left Gyre
// RA_LABEL LABEL_PORT1=DCP 8000
// RA_LABEL LABEL_PORT7=Fan
// RA_LABEL LABEL_PORT26=N/A
// RA_LABEL LABEL_PORT15=ATO
// RA_LABEL LABEL_PORT28=N/A
// RA_LABEL LABEL_PORT23=N/A
// RA_LABEL LABEL_PORT13=UV
// RA_LABEL LABEL_PORT18=N/A
// RA_LABEL LABEL_PORT3=Skimmer
// RA_LABEL LABEL_PORT22=N/A
// RA_LABEL LABEL_PORT11=DCP 6500
// RA_LABEL LABEL_PORT25=N/A
// RA_LABEL LABEL_PORT12=Dosing pump
// RA_LABEL LABEL_PORT5=Sump Wave
// RA_LABEL LABEL_PORT14=Left AP700
// RA_LABEL LABEL_PORT6=Right Gyre
// RA_LABEL LABEL_PORT17=Fuge Kessil
// RA_LABEL LABEL_PORT4=Right AP700
// RA_LABEL LABEL_DAYLIGHT=Daylight
// RA_LABEL LABEL_PORT21=N/A
// RA_LABEL LABEL_ACTINIC=Actinic
// RA_LABEL LABEL_PORT24=N/A
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: A few thing wizard did wrong, how to code it

Post by rimai »

The webwizard cannot set internal memory. You have to do it manually on Uapp or Android app.... :( Sorry
Roberto.
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

Re: A few thing wizard did wrong, how to code it

Post by symon_say »

Should i use In the code, instead of internal memory for the whole code?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: A few thing wizard did wrong, how to code it

Post by rimai »

You can do that or do what I said on previous post.
Roberto.
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

Re: A few thing wizard did wrong, how to code it

Post by symon_say »

Ok, I set it in code mode, everything thing to works now except the ATO I have Water level module and set to 10-15% but is not turning off at 15%, what code should i add to turn off the port.

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 <Humidity.h>
#include <DCPump.h>
#include <PAR.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.AddStandardMenu();  // Add Standard Menu
    ReefAngel.Use2014Screen();  // Let's use 2014 Screen
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    ReefAngel.SetTemperatureUnit( Celsius );  // set to Celsius Temperature
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    ReefAngel.FeedingModePortsE[1] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = 0;
    ReefAngel.WaterChangePortsE[0] = Port5Bit;
    ReefAngel.WaterChangePortsE[1] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port5Bit;
    ReefAngel.OverheatShutoffPortsE[0] = Port3Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[1] = Port3Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    ReefAngel.LightsOnPortsE[1] = 0;
    // Use T3 probe as temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T3_PROBE;
    // Set the Overheat temperature setting
    InternalMemory.OverheatTemp_write( 300 );

    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Port8 );
    ReefAngel.Relay.On( Box2_Port1 );
    ReefAngel.Relay.On( Box2_Port2 );
    ReefAngel.Relay.On( Box2_Port3 );
    ReefAngel.Relay.On( Box2_Port4 );

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


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

void loop()
{
    ReefAngel.Relay.DelayedOn( Port3,30 );
    ReefAngel.Relay.DelayedOn( Box1_Port3,5 );
    ReefAngel.WaterLevelATO( Box1_Port5,10,15,1200 );
    ReefAngel.WaterLevelATO( Box2_Port5,10,15,1800 );
    ReefAngel.DosingPumpRepeat( Port5,0,60,300 );
    ReefAngel.WavemakerRandom( Port6,3600,7200 );
    ReefAngel.Relay.Set( Box1_Port6, !ReefAngel.Relay.Status( Port6 ) );
    ReefAngel.Relay.Set( Box2_Port6, !ReefAngel.Relay.Status( Port6 ) );
    ReefAngel.StandardLights( Box1_Port7,21,55,23,59 );
    ReefAngel.StandardLights( Box2_Port7,21,55,1,0 );
    ReefAngel.StandardFan( T3_PROBE,Port7,288,300 );
    if ( ReefAngel.Relay.Status( Box1_Port1 ) ) ReefAngel.Relay.Off( Box1_Port3 );

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


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

    ReefAngel.Portal( "symon_say" );
    // This should always be the last line
    ReefAngel.ShowInterface();
}



// RA_STRING1=null
// RA_STRING2=null
// RA_STRING3=null
// RA_LABEL LABEL_PORT8=Carbon
// RA_LABEL LABEL_PORT27=N/A
// RA_LABEL LABEL_PORT2=Sump Led
// RA_LABEL LABEL_PORT16=Left Jebao
// RA_LABEL LABEL_PORT1=DCP 8000
// RA_LABEL LABEL_PORT7=Fan
// RA_LABEL LABEL_PORT26=N/A
// RA_LABEL LABEL_PORT15=ATO
// RA_LABEL LABEL_PORT24=N/A
// RA_LABEL LABEL_PORT28=N/A
// RA_LABEL LABEL_PORT23=N/A
// RA_LABEL LABEL_PORT13=UV
// RA_LABEL LABEL_PORT18=N/A
// RA_LABEL LABEL_PORT3=Skimmer
// RA_LABEL LABEL_PORT22=N/A
// RA_LABEL LABEL_PORT11=DCP 6500
// RA_LABEL LABEL_PORT25=N/A
// RA_LABEL LABEL_PORT5=Sump Wave
// RA_LABEL LABEL_PORT14=Left Kessil
// RA_LABEL LABEL_PORT17=Fuge Kessil
// RA_LABEL LABEL_PORT4=Right AP700
// RA_LABEL LABEL_DAYLIGHT=Daylight
// RA_LABEL LABEL_PORT21=N/A
// RA_LABEL LABEL_PORT12=Dosing pump
// RA_LABEL LABEL_PORT6=Right Gyre
// RA_LABEL LABEL_ACTINIC=Actinic
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: A few thing wizard did wrong, how to code it

Post by rimai »

Use this:

Code: Select all

    if (ReefAngel.WaterLevel.GetLevel()<10) ReefAngel.Relay.On(Box1_Port5); 
    if (ReefAngel.WaterLevel.GetLevel()>15) ReefAngel.Relay.Off(Box1_Port5); 
    if (ReefAngel.WaterLevel.GetLevel()<10) ReefAngel.Relay.On(Box2_Port5); 
    if (ReefAngel.WaterLevel.GetLevel()>15) ReefAngel.Relay.Off(Box2_Port5); 
instead of this:

Code: Select all

    ReefAngel.WaterLevelATO( Box1_Port5,10,15,1200 );
    ReefAngel.WaterLevelATO( Box2_Port5,10,15,1800 );
Roberto.
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

Re: A few thing wizard did wrong, how to code it

Post by symon_say »

Thanks.

Is this code correct? it's suppose to turn off a port in case another por is off:

Code: Select all

if ( ReefAngel.Relay.Status( Port1 ) ) ReefAngel.Relay.Off( Port2 );
I ask because I set the statement in the wizard for on and off ports and both give the same syntax in condition:

Code: Select all

if ( ReefAngel.Relay.Status( Port1 ) ) ReefAngel.Relay.Off( Port2 );
    if ( ReefAngel.Relay.Status( Port1 ) ) ReefAngel.Relay.On( Port2 );
Image
symon_say
Posts: 119
Joined: Sun Oct 09, 2011 6:04 am
Location: Dominican Republic
Contact:

Re: A few thing wizard did wrong, how to code it

Post by symon_say »

Right now i have my wavemakers set to turn on random from 30-60 min and set to opposite each other.

Code: Select all

ReefAngel.WavemakerRandom( Port6,1800,3600 );
    ReefAngel.Relay.Set( Box1_Port6, !ReefAngel.Relay.Status( Port6 ) );
I'll like to add both pumps turning on random to, how can I code random turn on of left, right and both preferably 30-60 min?
Image
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: A few thing wizard did wrong, how to code it

Post by rimai »

Try this:

Code: Select all

ReefAngel.WavemakerRandom1( Port6,1800,3600 );
ReefAngel.WavemakerRandom2( Port6,1800,3600 );
Roberto.
Post Reply