New DCPump Modes - How to code???

Do you have a question on how to do something.
Ask in here.
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

New DCPump Modes - How to code???

Post by Paul_Velasco »

Is there a place where the new modes are explained and how to code? Getting ready to upgrade to new LIB 1.1.1 and would like to include the new modes.

Thanks in advance and apologies if this has been answered before. I tried searching.
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

They're easy if you're using the DCPump libraries already.

Code: Select all

ReefAngel.DCPump.SetMode(Else,midpoint,offset);
Generates a random flow from midpoint-offset to midpoint+offset. For example, if you use:

Code: Select all

ReefAngel.DCPump.SetMode(Else,50,20);
You'll get a random flow that ranges between 30 and 70.

Code: Select all

ReefAngel.DCPump.SetMode(Gyre,speed,duration,threshold);
Generates a long, slow sine wave. Speed is the max speed, duration (in minutes), and threshold is the minimum speed. If you leave off threshold it will use 30 (or whatever you have set with DCPump.Threshold).

I'm not familiar with Sine. Maybe someone else can chime in.

--Colin
Last edited by cosmith71 on Thu Jan 01, 2015 5:47 am, edited 1 time in total.
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

There are release notes here:

http://forum.reefangel.com/viewtopic.php?f=7&t=1473

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Thanks man, you are always a great help!!!!

Anyone with the Sine mode help? Or will I be just duplicating with the Gyre Mode.
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

You're welcome!

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Code: Select all

 ReefAngel.PWM.SetDaylight( GyreMode(30,100,10,true); //Ramp up to 70% in 10mins in sync mode
 ReefAngel.PWM.SetActinic( SineMode(30,100,10,true)); //Ramp up to 70% in 10mins in sync mode   


GyreMode is not working?
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

That code will run it from 30% to 10% over 100 minutes.

Jebao's generally don't work well under 30%. Also, this is a very long cycle time (1 hour 40 minutes). What is it not doing?

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

The pumps limit is right at 30%, verified operation at that level.
I thought the 10 was the duration, so 10 minutes not 100? Otherwise I will change the code.

It does not recognize GyreMode. The text, GyreMode, stays black in my IDE. Usually if accepted it will turn the text to orange. Load the program and the pump runs at 0% (Looking in my RA Client). I have Lib V 1.1.1 loaded as well. Else mode and Sine mode work perfect.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New DCPump Modes - How to code???

Post by rimai »

The color change on the text is probably an oversight on my part.
We can pick and choose which words turn which color.
I'll add GyreMode to the list.
Roberto.
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

So is duration wrong?

This is how I coded

GyreMode( Low %, High%, Duration min, bolean)

Is it really

GyreMode( Low %, Duration min, High%, bolean)
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

I believe it's high, duration minutes, low.

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

OK will try

I coded it in error at first, gave me compile error Too few arguments , GyreMode (Byte, Byte, Int, Boolean). So I thought the first two arguments were Low% and High%.

Will change to make the duration in the middle.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New DCPump Modes - How to code???

Post by rimai »

This is the function arguments:

Code: Select all

byte GyreMode(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync);
Roberto.
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

There you go. :)

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Code: Select all

ReefAngel.PWM.SetDaylight (GyreMode(40,100,10,true) ); // Short pulse at 60% with 200m
ReefAngel.PWM.SetActinic(GyreMode(40,100,10,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
(comments are wrong)

It is definitely not working with this code??? Anything amiss?
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

Post the rest of the code.
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

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

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

unsigned long LastUpdate1=0;    // For virtual Vinegar dosing pumps
unsigned long LastUpdate2=0;    // For virtual Magnesium dosing pumps
unsigned long LastUpdate3=0;    // For virtual ATO dosing pump

////// 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 
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddWaterLevelExpansion();  // Water Level Expansion Module
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = 0;
    ReefAngel.FeedingModePortsE[0] = Port1Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port7Bit | Port8Bit;
    ReefAngel.WaterChangePortsE[0] = Port1Bit | Port3Bit | Port5Bit | Port7Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    ReefAngel.LightsOnPortsE[0] = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 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( 850 );

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


    // Ports that are always on
    ReefAngel.Relay.On( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port3 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port5 );
    ReefAngel.Relay.On( Port6 );
    ReefAngel.Relay.On( Box1_Port5 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port7,750,755 );
    ReefAngel.StandardFan( Port8,760,800 );
    ReefAngel.Relay.DelayedOn( Box1_Port1,5 );
    ReefAngel.StandardLights( Box1_Port3,20,0,8,0 );
    //ReefAngel.WaterLevelATO( Box1_Port7,60,48,50 );
    ReefAngel.RF.UseMemory = false;
    ReefAngel.RF.SetMode( Constant,75,100);
    //Use salinity compensation
    ReefAngel.Salinity.SetCompensation(0);
    ////// Place your custom code below here
    
    //Only use the ATO when no one is in house and there is water in reservior
    //Use Channel 4&2 as Redundant Controls.
    if (hour()>=6 && hour()<=23)
    {
      if (ReefAngel.WaterLevel.GetLevel(4)<=47 && ReefAngel.WaterLevel.GetLevel(1)>0) ReefAngel.Relay.On(Box1_Port7);
      if (ReefAngel.WaterLevel.GetLevel(4)>50) ReefAngel.Relay.Off(Box1_Port7);
    }
    else 
    {
      ReefAngel.Relay.Off(Box1_Port7);
    }
//Turn-off Skimmer whhen skimmer tank is full
    if (ReefAngel.WaterLevel.GetLevel(3)>=90)
    {
      ReefAngel.Relay.Off(Box1_Port1);       
    }else{
      ReefAngel.Relay.On(Box1_Port1);
    }
//How about some WaveMotion with the Vortech
    static time_t feeding;
// Time schedule first
    if (hour()>=6 && hour()<7) {
      ReefAngel.PWM.SetDaylight( LongPulseMode(30,100,5,true) ); // Long pulse hi/low 50%20% 10s pulse on sync mode
      ReefAngel.PWM.SetActinic( LongPulseMode(30,100,5,false) ); // Long pulse hi/low 50%20% 10s pulse on anti-sync mode
    } else if (hour()>=7 && hour()<8) {
      ReefAngel.PWM.SetDaylight ( ElseMode( 80,20, true) ); // Short pulse at 60% with 200m
      ReefAngel.PWM.SetActinic( ElseMode(80,20,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
    } else if (hour()>=8 && hour()<10) {
      ReefAngel.PWM.SetDaylight( SineMode(30,100,180,true)); //Ramp up to 100% in 3mins in sync mode
      ReefAngel.PWM.SetActinic( SineMode(30,100,180,true)); //Ramp up to 100% in 3mins in sync mode
    } else if (hour()>=10 && hour()<11) {
      ReefAngel.PWM.SetDaylight( ShortPulseMode(30,100,200,true) ); // Short pulse at 60% with 200ms pulse on sync mode
      ReefAngel.PWM.SetActinic( ShortPulseMode(30,100,200,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
    } else if ( (hour()>=11 && hour()<13) && (now()-feeding > SECS_PER_DAY) ) { // We haven't fed today
      ReefAngel.PWM.SetDaylight( NutrientTransportMode(30,100,500,true) );
      ReefAngel.PWM.SetActinic( NutrientTransportMode(30,100,500,false) );
    } else if (hour()>=11 && hour()<13) {
      ReefAngel.PWM.SetDaylight( ReefCrestMode(90,10,true) ); // ReefCrest at 70% +/- 20% on sync mode
      ReefAngel.PWM.SetActinic( ReefCrestMode(90,10,false) ); // ReefCrest at 70% +/- 20% on anti-sync mode
    } else if (hour()>=13 && hour ()<14) {
      ReefAngel.PWM.SetDaylight( ShortPulseMode(30,100,500,true) ); // Short pulse at 60% with 200ms pulse on sync mode
      ReefAngel.PWM.SetActinic( ShortPulseMode(30,90,500,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
    } else if (hour()>=14 && hour()<15) {
      ReefAngel.PWM.SetDaylight ( ElseMode( 80,20, true) ); // Short pulse at 60% with 200m
      ReefAngel.PWM.SetActinic( ElseMode(80,20,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
      //ReefAngel.PWM.SetDaylight ( GyreMode( 30, 100, 10, true) ); // Short pulse at 60% with 200m
      //ReefAngel.PWM.SetActinic( GyreMode(30,100, 10, true) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
    } else if (hour()>=15 && hour()<16) {
      ReefAngel.PWM.SetDaylight( SineMode(30,100,30,true)); //Ramp up to 70% in 10mins in sync mode
      ReefAngel.PWM.SetActinic( SineMode(30,100,30,true)); //Ramp up to 70% in 10mins in sync mode    
    } else if (hour()>=16 && hour()<17) {
      ReefAngel.PWM.SetDaylight( NutrientTransportMode(30,100,250,true) );
      ReefAngel.PWM.SetActinic( NutrientTransportMode(30,100,250,false) ); 
      //ReefAngel.PWM.SetDaylight( ElseMode(75,20,true) );
      //ReefAngel.PWM.SetActinic( ElseMode(75,20,false) );
      //ReefAngel.PWM.SetDaylight( ReefCrestMode(75,25,true) ); // ReefCrest at 70% +/- 20% on sync mode
      //ReefAngel.PWM.SetActinic( ReefCrestMode(75,25,false) ); // ReefCrest at 70% +/- 20% on anti-sync mode  
    } else if (hour()>=17 && hour ()<19) {
      ReefAngel.PWM.SetDaylight( SineMode(30,100,20, true)); //Ramp up to 70% in 10mins in sync mode
      ReefAngel.PWM.SetActinic( SineMode(30,100,20, false)); //Ramp up to 70% in 10mins in sync mode 
      //ReefAngel.PWM.SetDaylight( ShortPulseMode(10,100,200,true) ); // Short pulse at 60% with 200ms pulse on sync mode
      //ReefAngel.PWM.SetActinic( ShortPulseMode(10,100,200,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode            
    } else {
      //ReefAngel.PWM.SetDaylight (GyreMode(40,100,10,true) ); // Short pulse at 60% with 200m
      //ReefAngel.PWM.SetActinic(GyreMode(40,100,10,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode      
      //ReefAngel.PWM.SetDaylight ( ElseMode(80,20, true) ); // Short pulse at 60% with 200m
      //ReefAngel.PWM.SetActinic( ElseMode(80,20,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode
      ReefAngel.PWM.SetDaylight( SineMode(30,100,30,true)); //Ramp up to 70% in 10mins in sync mode
      ReefAngel.PWM.SetActinic( SineMode(30,100,30,true)); //Ramp up to 70% in 10mins in sync mode
    }   
// If we are feeding override the schedule
    if (ReefAngel.DisplayedMenu==FEEDING_MODE) 
    {
      ReefAngel.PWM.SetDaylight(30);
      ReefAngel.PWM.SetActinic(30);
      //Vortech
      ReefAngel.RF.SetMode( Constant,50,100 );      
      feeding=now(); 
    }
// If we have finished feeding, start NTM for 3 hours
    if (now()-feeding < 3*SECS_PER_HOUR) 
    {
      ReefAngel.PWM.SetDaylight( NutrientTransportMode(30,100,500,true) );
      ReefAngel.PWM.SetActinic( NutrientTransportMode(30,100,500,false) );
      //vortech
      ReefAngel.RF.SetMode(Smart_NTM,100,10);
    }
//Do not use the memory bits inside the Vortech
     ReefAngel.RF.UseMemory = false;
//Time based Vortech Schedule
    if (hour()>=9 && hour()<10) {
      ReefAngel.RF.SetMode(ReefCrest,100,10);
    } else if (hour()>=10 && hour()<11) {
      ReefAngel.RF.SetMode(Smart_TSM,100,10);
    } else if (hour()>=11 && hour()<12) {
      ReefAngel.RF.SetMode(ShortPulse,100,10); 
    } else if (hour()>=12 && hour()<13) {
      ReefAngel.RF.SetMode(Smart_NTM,100,10);
    } else if (hour()>=13 && hour()<14) {      
      ReefAngel.RF.SetMode(Smart_TSM,100,10);
    } else if (hour()>=14 && hour()<15){
      ReefAngel.RF.SetMode(LongPulse,100,10);
    } else if (hour()>=15 && hour()<16) {  
      ReefAngel.RF.SetMode(ReefCrest,100,10);
    } else if (hour()>=16 && hour()<17) {
      ReefAngel.RF.SetMode(Smart_TSM,100,10);
    } else if (hour()>=17 && hour()<18) {
      ReefAngel.RF.SetMode(ShortPulse,100,10); 
    } else if (hour()>=18 && hour()<19) {
      ReefAngel.RF.SetMode(Smart_NTM,100,10);
    } else if (hour()>=19 && hour()<20) {      
      ReefAngel.RF.SetMode(Smart_TSM,100,10);
    } else if (hour()>=20 && hour()<21){
      ReefAngel.RF.SetMode(LongPulse,100,10);
    } else {
      //ReefAngel.RF.SetMode(Lagoon,40,10);
       ReefAngel.RF.SetMode(Else, 80,20);
    } 
//Code to make Vodka Dosing Work one time a day for 11 mins  
//Turn on at 8:00 AM 
    ReefAngel.DosingPumpRepeat(Box1_Port6,480,1440,450);
///Code to make Vinegar Dosing Work 4 mins 
    ReefAngel.DosingPumpRepeat(Box1_Port8,0,60,120);
///Do not turn on Vinegar if lights are off
    if (hour()<=8 || hour()>21) {
      ReefAngel.Relay.Off(Box1_Port8);
    }  
//Code to make Magnesium Dosing Work
    ReefAngel.DosingPumpRepeat(Box1_Port4,15,60,120);
//Code to check that the dosing pumps are running
// *******************  Turn on imaginary relays for 5 minutes when dosing pumps activate so Portal can track them  *******************
// Vinegar port 
    if (ReefAngel.Relay.Status(Box1_Port8) && LastUpdate1==0)
    {
      LastUpdate1 = now();
      ReefAngel.Relay.On (Box2_Port1);
    }
    if (now() - LastUpdate1 >= 300 && LastUpdate1 != 0)
    {
      LastUpdate1 = 0;
      ReefAngel.Relay.Off (Box2_Port1);
    }
// Magnesium Port
    if (ReefAngel.Relay.Status(Box1_Port4) && LastUpdate2==0)
    {
      LastUpdate2 = now();
      ReefAngel.Relay.On (Box2_Port2);
    }
    if (now() - LastUpdate2 >= 300 && LastUpdate2 != 0)
    {
      LastUpdate2 = 0;
      ReefAngel.Relay.Off (Box2_Port2);
    }
// ATO Port
    if (ReefAngel.Relay.Status(Box1_Port7) && LastUpdate3==0)
    {
      LastUpdate3 = now();
      ReefAngel.Relay.On (Box2_Port3);
    }
    if (now() - LastUpdate3 >= 300 && LastUpdate3 != 0)
    {
      LastUpdate3 = 0;
      ReefAngel.Relay.Off (Box2_Port3);
    }
////// Place your custom code above here

// This should always be the last line1
    ReefAngel.Portal( "Paul_Velasco" );
    ReefAngel.ShowInterface();
}
Here it is. I am trying to code a more random wave patttern, but that is for another day.
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

How is it not working? What is it doing/not doing?

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

(I uncomment in the else statement and comment the other mode so the gyre is only one working)

When I look at the ReefClient on my desktop I get 0% for the pumps on the two channels when running GyreMode.
I physically look at the pumps and they are stopped.
Any of the other modes I run on those channels work perfectly.

Raised the lower limit to 40% thinking that may have been the problem.
Image
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Anyone have any ideas why Gyre is not working
Image
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

I uncommented the GyreModes and uploaded your code to one of my RA+ units. I manually changed the time to 1400 and 1900 and it worked both times.

The only thing I can recommend is doing an un-install/re-install of the the RA software on your computer. Maybe you have a corrupted library.

--Colin
User avatar
cosmith71
Posts: 1432
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: New DCPump Modes - How to code???

Post by cosmith71 »

The only potential problem I see is that between 1400 and 1500 you have both pumps set to sync. That means they will both be on for 10 minutes and off for 10 minutes at the same time.

--Colin
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Ok I will change sync

Will try to do a clean install
Image
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

Reinstall did not work?
Is there something in the registry to delete?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: New DCPump Modes - How to code???

Post by rimai »

Upload this code and see what you get:

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 
    // 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;

    // Ports that are always on

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

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

void loop()
{
    ////// Place your custom code below here
      
    ReefAngel.PWM.SetDaylight (GyreMode(40,100,10,true) ); // Short pulse at 60% with 200m
    ReefAngel.PWM.SetActinic(GyreMode(40,100,10,false) ); // Short pulse at 60% with 200ms pulse on anti-sync mode

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

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

It worked for me.
Roberto.
Paul_Velasco
Posts: 126
Joined: Thu Sep 19, 2013 7:46 am
Location: Saint Cloud, FL

Re: New DCPump Modes - How to code???

Post by Paul_Velasco »

To Close this out:

Uninstalled and resinstalled Arduino application, did this twice. Then reinstalled once again last night and it worked?? No idea why it just worked.
Image
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

cosmith71 wrote:They're easy if you're using the DCPump libraries already.

Code: Select all

ReefAngel.DCPump.SetMode(Else,midpoint,offset);
Generates a random flow from midpoint-offset to midpoint+offset. For example, if you use:

Code: Select all

ReefAngel.DCPump.SetMode(Else,50,20);
You'll get a random flow that ranges between 30 and 70.

Code: Select all

ReefAngel.DCPump.SetMode(Gyre,speed,duration,threshold);
Generates a long, slow sine wave. Speed is the max speed, duration (in minutes), and threshold is the minimum speed. If you leave off threshold it will use 30 (or whatever you have set with DCPump.Threshold).

I'm not familiar with Sine. Maybe someone else can chime in.

--Colin
Are these DCPump codes meant for a single pump? How do I code for 2 pumps connected to the Actinic and DayLight channels?

Dr Davaraj
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

You will have lines like this in the setup section of your code

ReefAngel.DCPump.ActinicChannel = Sync;
ReefAngel.DCPump.DaylightChannel = AntiSync;

If you want to disable one channel you can set it to None.

If you want both pumps to do the same thing then set them both to Sync.
davaraj
Posts: 98
Joined: Sun Jul 21, 2013 8:18 am

Re: New DCPump Modes - How to code???

Post by davaraj »

lnevo wrote:You will have lines like this in the setup section of your code

ReefAngel.DCPump.ActinicChannel = Sync;
ReefAngel.DCPump.DaylightChannel = AntiSync;

If you want to disable one channel you can set it to None.

If you want both pumps to do the same thing then set them both to Sync.
I have recoded like this. I do have

ReefAngel.DCPump.ActinicChannel = Sync
ReefAngel.DCPump.DaylightChannel = AntiSync

In the setup section.

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

if (hour()>=4 && hour()<8)
{
ReefAngel.DCPump.SetMode(Sine, 30, 40);
}
else if (hour()>=8 && hour()<12)
{
ReefAngel.DCPump.SetMode(TidalSwell, 55); // TidalSwell at 55%
}
else if (hour()>=12 && hour()<16)
{
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
}
else if (hour()>=16 && hour()<19)
{
ReefAngel.DCPump.SetMode(LongPulse, 0, 50, 10); // Long pulse at 0% to 50% with 10s pulse
}
else if (hour()>=19 && hour()<23)
{
ReefAngel.DCPump.SetMode(Else, 40, 10); // ElseMode 40 +/- 10%
}
else
{
ReefAngel.DCPump.SetMode(Gyre, 30, 50, 10); //GyreMode from 30% to 50% for 10 minutes
}

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

When I run 'verify' code it compiles, except for:

ReefAngel.DCPump.SetMode(TidalSwell, 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);

When I insert this:
ReefAngel.DCPump.SetMode(TidalSwell, 55, true); it compiles for this mode. However 'millis' gives errors. How do I code for millis (standing wave like W1 in Jebao controller)?
Image
User avatar
lnevo
Posts: 5422
Joined: Fri Jul 20, 2012 9:42 am

Re: New DCPump Modes - How to code???

Post by lnevo »

ReefAngel.DCPump.SetMode(TidalSwell 55); and
ReefAngel.DCPump.SetMode(millis();1200>750?50:0);
You need 3 arguments to SetMode separated by a comma. Mode Speed and Duration. The first only has 2 and no comma and the second, that code block represents one argument and it represents a speed.

Try this:

ReefAngel.DCPump.SetMode(TidalSwell,55,0);

ReefAngel.DCPump.SetMode(Constant,millis();1200>750?50:0,0);
Post Reply