Wp 25 code

Do you have a question on how to do something.
Ask in here.
Post Reply
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Wp 25 code

Post by mask0017 »

Hi found this code for switch wave modes and cant get it too work can anybody help me?
#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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

ReefAngel.Use2014Screen(); // Let's use 2014 Screen
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync;
ReefAngel.DCPump.ActinicChannel = None;

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

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


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

void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.DaylightChannel = Sync;

////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);

if (hour()>=8 && hour()<12)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
else if (hour()>=12 && hour()<16)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% + - 20 on sync mode
}
else if (hour()>=16 && hour()<17)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(75,90,2000,true) ); // Nutrient Transport on sync mode
}
else if (hour()>=17 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 75% + - 20 on sync mode
}
else if (hour()>=20 && hour()<00)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
else
{
ReefAngel.PWM.SetDaylight( LongPulseMode(0,40,10,true) ); // Long pulse at 40% with 10s pulse on sync mode
}
////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Wp 25 code

Post by cosmith71 »

What does it do now? Anything?

You might need to add ReefAngel.DCPump.UseMemory = false; at the top of your loop.

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

Re: Wp 25 code

Post by cosmith71 »

Try 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 <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.SetTemperatureUnit( Celsius ); // set to Celsius Temperature

ReefAngel.Use2014Screen(); // Let's use 2014 Screen 
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync;
ReefAngel.DCPump.ActinicChannel = None;

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

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


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

void loop()
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.DaylightChannel = Sync;

////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);

ReefAngel.PWM.SetDaylight( LongPulseMode(0,40,10,true) ); // Long pulse at 40% with 10s pulse on sync mode

if (hour()>=8 && hour()<12)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
if (hour()>=12 && hour()<16)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% + - 20 on sync mode
}
if (hour()>=16 && hour()<17)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(75,90,2000,true) ); // Nutrient Transport on sync mode
}
if (hour()>=17 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 75% + - 20 on sync mode
}
if (hour()>=20 && hour()<00)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Just loaded that up and it's now Constant 0,0
Before it was sitting at Reefcrest 65.10 but wasn't changing
Thanks
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Wp 25 code

Post by cosmith71 »

Is that off the Portal? I'm not sure you can go by that if you're using ReefAngel.PWM.SetDaylight to set the pumps. You'd need something like ReefAngel.DCPump.SetMode(LongPulse,40,10) for the Portal to reflect it correctly.

It's probably working correctly, you just can't tell from the Portal.

--Colin
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

cosmith71 wrote:Is that off the Portal? I'm not sure you can go by that if you're using ReefAngel.PWM.SetDaylight to set the pumps. You'd need something like ReefAngel.DCPump.SetMode(LongPulse,40,10) for the Portal to reflect it correctly.

It's probably working correctly, you just can't tell from the Portal.

--Colin
+1
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Pumps not running at all now ?
So are you saying to change all the lines like this .............

ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) )

To this
ReefAngel.DCPump.SetMode( ReefCrestMode(80,20,true) )

Thanks
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Wp 25 code

Post by cosmith71 »

No, not exactly. When I have some time I'll try to figure it out for you unless someone else (Lee?) wants to have a go at it.

Are you sure it's not running? Did you stick your hand in front of it to check?

--Colin
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Yes was def not going no movement on prop at all .
Have it running with different code but just constant.
Was looking to try and get it to cycle through the modes throughout the day.
Thanks
mask0017
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

The only way I can see that code not working is if you are using the wrong port. Also you can't look at the DCPump section in the portal because you're not using it. Just look at the Daylight/Actinic channels. But I don't see any reason in the code why it would not be working.

The only thing is this won't work:
if (hour()>=20 && hour()<00)

You just need this:
if(hour()>=20)

But that would only affect the last mode. So actually it may have depended on what time you were testing... but even then you should have been on LongPulseMode.

The DCPump won't show any mode or speed because we aren't setting them anywhere. So that would explain why you see Constant / 0 / 0.
hedrickms
Posts: 32
Joined: Tue Jul 29, 2014 7:36 pm

Re: Wp 25 code

Post by hedrickms »

Check your cables for loose wires or pins. I had that issue that stopped my pump from working. I had to look very closely as one of the wires popped out of the pin seat.
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Hi
Yes cables are ok.
Loaded up this code and portal says Actinic 0% Daylight 0% Dc Pump Constant 0/0 . That was at 17:15 just after code load up Pump not going.
Although not sure what it should be doing at that time. Nutrient transport whatever that does, not sure how pumps spins for that mode
--------------------------

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


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


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

ReefAngel.Use2014Screen(); // Let's use 2014 Screen 
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync;
ReefAngel.DCPump.ActinicChannel = None;

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

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


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

void loop()
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );
ReefAngel.DCPump.DaylightChannel = Sync;

////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);

ReefAngel.PWM.SetDaylight( LongPulseMode(0,40,10,true) ); // Long pulse at 40% with 10s pulse on sync mode

if (hour()>=8 && hour()<12)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
if (hour()>=12 && hour()<16)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 80% + - 20 on sync mode
}
if (hour()>=16 && hour()<17)
{
ReefAngel.PWM.SetDaylight( NutrientTransportMode(75,90,2000,true) ); // Nutrient Transport on sync mode
}
if (hour()>=17 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 75% + - 20 on sync mode
}
if (hour()>=20)
{
ReefAngel.PWM.SetDaylight( TidalSwellMode(60,true) ); // Tidal Swell at 60% on sync mode
}
////// Place your custom code above here

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

Re: Wp 25 code

Post by lnevo »

At 17:15 you should be running ReefCrestMode

if (hour()>=17 && hour()<20)
{
ReefAngel.PWM.SetDaylight( ReefCrestMode(80,20,true) ); // ReefCrest at 75% + - 20 on sync mode
}

What's the longest and when you've left this code running? The forum portal charts shows a pretty good movement.

http://forum.reefangel.com/status/chart ... ilter=PWMD
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Left it running during night last night. 23:00 - 07:00 That would be UK time.
Changed it this morning and have been trying different codes.
It's running the last one I put up now. Will leave it like that for a while if you would like to check
Thanks
mask
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

It says your around 61% at the moment.
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Yes did that here then it goes back to 0% as it is now, but pump dosn't run at all
Only does it with this code. If use wizard and set Reefcrest or any of the others pump runs fine.
Thanks
mask0017
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Image

This what get most of time. If the Pic works
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

Two things. Please set your mode to "Custom" in the Internal Memory section. You have this set to ReefCrest and it could be conflicting with your override.

If that doesn't help, try changing this to None

ReefAngel.DCPump.DaylightChannel = Sync;

You have it twice so I would change it in both. Let us know how it goes. It's odd the portal is reporting your speeds properly in the charts... let's see what happens when you change that.
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Image

It did seem to be on custom.Will change the code tomoz. Night in UK just now can't get in tank room
Thanks
mask
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

The portal has not been reporting the mode being at 11 (Custom) in your charts. It's showing the last update at 12pm that it was at 2pm. This means that since your INO has the UseMemory=false that it's not being set. And since you've defined the pump as a DCPump it could be doing something unexpected. Also, you should set the duration to something sane and not 255 as it's considered an un-initialized value.

I would take the next step as changing DCPump to None in the code and see what happens. At some point we'll convert this INO to use the DCPump instead of the raw PWM commands to set what we want.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

Here's the code converted to use DCPump just to get that out of the way.

The only thing it doesn't do at this moment is allow you to use the portal to change it. We should see the mode and speed change properly and be reflected in the portal (just not in the Internal Memory section).

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


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


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

ReefAngel.Use2014Screen(); // Let's use 2014 Screen 
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync;
ReefAngel.DCPump.ActinicChannel = None;

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

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


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

void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );

////// Place your custom code below here
if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);

ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( LongPulse,40,10 ); // Long pulse at 40% with 10s pulse on sync mode

if (hour()>=8 && hour()<12)
{
  ReefAngel.DCPump.SetMode( TidalSwell, 60, 0 ); // Tidal Swell at 60% on sync mode
}
if (hour()>=12 && hour()<16)
{
  ReefAngel.DCPump.SetMode( ReefCrest, 80, 0 ); // ReefCrest at 80% + - 20 on sync mode
}
if (hour()>=16 && hour()<17)
{
  ReefAngel.DCPump.SetMode( NutrientTransport, 90, 0 ); // Nutrient Transport on sync mode
}
if (hour()>=17 && hour()<20)
{
  ReefAngel.DCPump.SetMode( ReefCrest, 80, 0 ); // ReefCrest at 75% + - 20 on sync mode
}
if (hour()>=20)
{
  ReefAngel.DCPump.SetMode( TidalSwell, 60, 0 ); // Tidal Swell at 60% on sync mode
}
////// Place your custom code above here

// This should always be the last line
ReefAngel.Portal( "mask0017" );
ReefAngel.ShowInterface();
}
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Thanks a lot for that. Will get it loaded up tomorrow.
Sorry for being a bit of a pest but no much idea about coding.
Be good for the likes of me if you could set different modes at time you want by the wizard.
Wizard=Easy ....... Coding = Brick wall with head stuck in it.
Thanks
mask
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

For the most part you did alright getting that chunk of code in and honestly not sure 100% the why it's not working part, except for telling it to use DCPump and then not using it. I think that's our biggest problem. Because you never say to use InternalMemory everything is getting default 0 0 0 and even though we are specifying the speeds to the Daylight channel directly, the DCPump is overriding it. I think this is the main issue and should be addressed by the above.
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Re: Wp 25 code

Post by mask0017 »

Have got that loaded up now. Working perfect.
That's great working exactly the way I was wanting.
Big thanks for all the help.
Only got to get a delay on the ATO port to make code finished
Something like this maybe?
ReefAngel.DelayedOn(Port1, 5);
But thought I read somewhere about delay on ATO a no go
thanks
mask
User avatar
cosmith71
Posts: 1437
Joined: Fri Mar 29, 2013 3:51 pm
Location: Oklahoma City

Re: Wp 25 code

Post by cosmith71 »

What kind of delay are you looking for? Are you using a single or double switch ATO?

--Colin
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

Yeah delayed on won't work. I'll write something up for you in a little while.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Wp 25 code

Post by lnevo »

try this:

Code: Select all

static unsigned long atoTimer;

if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) atoTimer=now();

if (now()-atoTimer < 300) {
  ReefAngel.Relay.Off(Port1);
} else {
  ReefAngel.StandardATO(Port1,120);
}
mask0017
Posts: 23
Joined: Thu Jun 05, 2014 4:25 pm

Wp 25 code

Post by mask0017 »

Hi
Colin it's a standard 2 float switch ATO, was just needing a short delay after water change/feeding mode.
Thanks for all the help with the coding Lee.
Everything seems to be working fine now. Here's finished code, may help others needing same

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


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


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

ReefAngel.Use2014Screen(); // Let's use 2014 Screen 
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port3Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Ports toggled when Lights On / Off menu entry selected
ReefAngel.LightsOnPorts = 0;
// Ports turned off when Overheat temperature exceeded
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port3Bit | Port4Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Set the Overheat temperature setting
InternalMemory.OverheatTemp_write( 285 );

// Feeeding and Water Change mode speed
ReefAngel.DCPump.FeedingSpeed=0;
ReefAngel.DCPump.WaterChangeSpeed=0;
ReefAngel.DCPump.DaylightChannel=Sync;
ReefAngel.DCPump.ActinicChannel = None;

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

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


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

void loop()
{
ReefAngel.StandardATO( Port1,120 );
ReefAngel.Relay.DelayedOn( Port2,5 );
ReefAngel.StandardHeater( Port3,252,255 );
ReefAngel.StandardLights( Port4,20,0,8,0 );
ReefAngel.StandardLights( Port6,8,10,19,50 );
ReefAngel.StandardLights( Port7,8,5,19,55 );

////// Place your custom code below here
static unsigned long atoTimer;

if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) atoTimer=now();

if (now()-atoTimer < 300) {
  ReefAngel.Relay.Off(Port1);
} else {
  ReefAngel.StandardATO(Port1,120);
}

if (hour()<12)
ReefAngel.StandardLights(Port5, 6, 0, 8, 5);
else
ReefAngel.StandardLights(Port5, 18, 0, 20, 5);

ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( LongPulse,40,10 ); // Long pulse at 40% with 10s pulse on sync mode

if (hour()>=8 && hour()<12)
{
  ReefAngel.DCPump.SetMode( TidalSwell, 60, 0 ); // Tidal Swell at 60% on sync mode
}
if (hour()>=12 && hour()<16)
{
  ReefAngel.DCPump.SetMode( ReefCrest, 80, 0 ); // ReefCrest at 80% + - 20 on sync mode
}
if (hour()>=16 && hour()<17)
{
  ReefAngel.DCPump.SetMode( NutrientTransport, 90, 0 ); // Nutrient Transport on sync mode
}
if (hour()>=17 && hour()<20)
{
  ReefAngel.DCPump.SetMode( ReefCrest, 80, 0 ); // ReefCrest at 75% + - 20 on sync mode
}
if (hour()>=20)
{
  ReefAngel.DCPump.SetMode( TidalSwell, 60, 0 ); // Tidal Swell at 60% on sync mode
}
////// Place your custom code above here

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