Page 1 of 1

help with jebao code

Posted: Sat Dec 07, 2013 3:44 pm
by Paulweck
im trying to add my new wp-25 to my already running wp-40 for my 90 gallon tank. im currently running tidal swell mode on my wp40. i would like to have them both on tidal swell mode but have one ramp up while the other ramps down. i will be plugging the wp25 into my dimming expansion in the 1st channel. i would also like the pumps go into nutrient transport mode when lights go out at 9pm

if any of you code gurus give me a hand with this that would be great im not to good at writing code yet but im starting to understand..

heres my code as its set right now with just my wp40 thanks again
#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 <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.Use2014Screen(); // Let's use 2014 Screen
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port3Bit | Port8Bit;
    ReefAngel.FeedingModePortsE[0] = 0;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = 0;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port6Bit;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port6Bit | Port7Bit;
    ReefAngel.OverheatShutoffPortsE[0] = 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( 830 );

    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;


    // Ports that are always on
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port8 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );
    ReefAngel.Relay.On( Box1_Port3 );
    ReefAngel.Relay.On( Box1_Port4 );
    ReefAngel.Relay.On( Box1_Port5 );
    ReefAngel.Relay.On( Box1_Port6 );
    ReefAngel.Relay.On( Box1_Port7 );
    ReefAngel.Relay.On( Box1_Port8 );

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

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

void loop()
{
    ReefAngel.StandardLights( Port1,21,0,9,0 );
    ReefAngel.StandardLights( Port2,11,0,19,0 );
    ReefAngel.Relay.DelayedOn( Port3,30 );
    ReefAngel.SingleATO( true,Port4,120,0 );
    ReefAngel.StandardLights( Port6,9,0,21,0 );
    ReefAngel.StandardHeater( Port7,790,795 );
    ReefAngel.PWM.SetDaylight( MoonPhase() );
    ReefAngel.PWM.SetActinic( MoonPhase() );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( TidalSwell,100,20 );
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = None;
    ReefAngel.DCPump.ExpansionChannel[0] = None;
    ReefAngel.DCPump.ExpansionChannel[1] = None;
    ReefAngel.DCPump.ExpansionChannel[2] = None;
    ReefAngel.DCPump.ExpansionChannel[3] = None;
    ReefAngel.DCPump.ExpansionChannel[4] = None;
    ReefAngel.DCPump.ExpansionChannel[5] = None;
    ////// Place your custom code below here
    ReefAngel.DosingPumpRepeat(Box1_Port1,540,720,45); // Alk Dose every 720 minutes with 540 minutes offset for 45 seconds
    ReefAngel.DosingPumpRepeat(Box1_Port2,600,720,45); // Ca Dose every 720 minutes with 600 minutes offset for 45 seconds

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

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


Re: help with jebao code

Posted: Sun Dec 08, 2013 9:46 am
by rimai
To put the 1st channel of the dimming in anti-sync mode, you need to change this:

Code: Select all

ReefAngel.DCPump.ExpansionChannel[0] = None;
To this:

Code: Select all

ReefAngel.DCPump.ExpansionChannel[0] = AntiSync;
For NTM at 9pm, when does it come out of it?

Re: help with jebao code

Posted: Sun Dec 08, 2013 10:24 am
by Paulweck
i would guess it depends on how long the cycle last i would like to run the cycle twice. thanks for you help Roberto

Re: help with jebao code

Posted: Mon Dec 09, 2013 8:58 am
by rimai
It takes 2.5 hrs each cycle.

Re: help with jebao code

Posted: Mon Dec 09, 2013 8:38 pm
by Paulweck
then i would say 5 hours starting at 9pm. again thanks for the help

Re: help with jebao code

Posted: Mon Dec 09, 2013 9:51 pm
by rimai
Try this:

Code: Select all

if (hour()>=21 || hour()<2)
    ReefAngel.DCPump.SetMode( NutrientTransport,100,20 );
else
    ReefAngel.DCPump.SetMode( TidalSwell,100,20 );

Re: help with jebao code

Posted: Tue Dec 10, 2013 5:42 am
by lnevo
Doesn't he need to turn UseMemory=false?

Re: help with jebao code

Posted: Tue Dec 10, 2013 9:31 am
by rimai
His code already has :)

Re: help with jebao code

Posted: Tue Dec 10, 2013 10:23 am
by lnevo
My bad... I missed it.. that's what happens trying to read it from my phone...

Re: help with jebao code

Posted: Thu Dec 12, 2013 2:35 pm
by Paulweck
ok so i uploaded the code and its working but not correctly. when i first loaded the code my wp40 was at 60% and the wp-25 started at 50% there now both going up. i would like to have one at 50% and 100% and have the 50% go up and the 100% go down. if that makes sense. heres my code i just uploded.

#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 <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.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port3Bit | Port8Bit;
ReefAngel.FeedingModePortsE[0] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port3Bit | Port4Bit | Port5Bit | Port7Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = 0;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port6Bit;
ReefAngel.LightsOnPortsE[0] = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port6Bit | Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = 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( 830 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;


// Ports that are always on
ReefAngel.Relay.On( Port5 );
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port1 );
ReefAngel.Relay.On( Box1_Port2 );
ReefAngel.Relay.On( Box1_Port3 );
ReefAngel.Relay.On( Box1_Port4 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );

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


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

void loop()
{
ReefAngel.StandardLights( Port1,21,0,9,0 );
ReefAngel.StandardLights( Port2,11,0,19,0 );
ReefAngel.Relay.DelayedOn( Port3,30 );
ReefAngel.SingleATO( true,Port4,120,0 );
ReefAngel.StandardLights( Port6,9,0,21,0 );
ReefAngel.StandardHeater( Port7,790,795 );
ReefAngel.PWM.SetDaylight( MoonPhase() );
ReefAngel.PWM.SetActinic( MoonPhase() );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( TidalSwell,100,20 );
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = None;
ReefAngel.DCPump.ExpansionChannel[0] = None;
ReefAngel.DCPump.ExpansionChannel[1] = AntiSync;
ReefAngel.DCPump.ExpansionChannel[2] = None;
ReefAngel.DCPump.ExpansionChannel[3] = None;
ReefAngel.DCPump.ExpansionChannel[4] = None;
ReefAngel.DCPump.ExpansionChannel[5] = None;
////// Place your custom code below here
ReefAngel.DosingPumpRepeat(Box1_Port1,540,720,45); // Alk Dose every 720 minutes with 540 minutes offset for 45 seconds
ReefAngel.DosingPumpRepeat(Box1_Port2,600,720,45); // Ca Dose every 720 minutes with 600 minutes offset for 45 seconds
if (hour()>=21 || hour()<2)
ReefAngel.DCPump.SetMode( NutrientTransport,100,20 );
else
ReefAngel.DCPump.SetMode( TidalSwell,100,20 );
////// Place your custom code above here

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

Re: help with jebao code

Posted: Thu Dec 12, 2013 4:01 pm
by lnevo
Thats what it should be doing...you have one pump set sync and the other anti sync...should be fine.

Re: help with jebao code

Posted: Thu Dec 12, 2013 4:50 pm
by Paulweck
The portal is telling me that both pumps are at 92% and falling and i think one is moving faster then the other

thanks for all the help by the way