ReefCrest for Tunze
ReefCrest for Tunze
Hi,
Can u please help me code my pair of Tunzes to run on ReefCrest mode anti-sync?
Thanks,
~JaY
Can u please help me code my pair of Tunzes to run on ReefCrest mode anti-sync?
Thanks,
~JaY
Re: ReefCrest for Tunze
i saw that topic and used the code and i like it but how do i set the min speed at 30 as you arent supposed to go under that on the tunzes. I would like the max at 80 and the min at 30
ReefCrest for Tunze
Th range in that code is +/- 20 so if you set the speed at 55, you'll have a range of 75-35. If you want to increase the range to 25 which would give you 30-80, you'll need to change the s-20,s+20 line to 25's
ReefCrest for Tunze
Awesome I figured it was something simple like that. I'm still trying to get a grasp on all the coding but with the help of the board my coding is working great for me.lnevo wrote:Th range in that code is +/- 20 so if you set the speed at 55, you'll have a range of 75-35. If you want to increase the range to 25 which would give you 30-80, you'll need to change the s-20,s+20 line to 25's
Re: ReefCrest for Tunze
Will the code work for 2 tunzes anyti-sync mode?
byte ReefCrestMode(byte s)
{
static unsigned long lastmillis=millis();
static int newspeed=s;
if ((millis()-lastmillis) > 5000)
{
int delta;
delta=random(20);
if (delta<10) newspeed--; else newspeed++;
newspeed=constrain(newspeed,s-20,s+20);
newspeed=constrain(newspeed,0,100);
lastmillis=millis();
}
return newspeed;
}
Re: ReefCrest for Tunze
Try this:
Code: Select all
byte ReefCrestMode(byte s, boolean sync)
{
static unsigned long lastmillis=millis();
static int newspeed=s;
if ((millis()-lastmillis) > 5000)
{
int delta;
delta=random(20);
if (delta<10) newspeed--; else newspeed++;
newspeed=constrain(newspeed,s-20,s+20);
newspeed=constrain(newspeed,0,100);
lastmillis=millis();
}
if (sync)
return newspeed;
else
return s-(newspeed-s);
}
Roberto.
Re: ReefCrest for Tunze
Will do - Thanks once again Roberto.
ReefCrest for Tunze
Awesome I was wondering this as well.
Re: ReefCrest for Tunze
Here's my current code - Where should I put the new code?
#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 <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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = 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 = Port2Bit | Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1 );
ReefAngel.MoonLights( Port3 );
ReefAngel.Wavemaker1( Port5 );
ReefAngel.Wavemaker1( Port6 );
ReefAngel.StandardHeater( Port7 );
ReefAngel.DayLights( Box1_Port1 );
ReefAngel.ActinicLights( Box1_Port2 );
ReefAngel.DayLights( Box1_Port3 );
ReefAngel.ActinicLights( Box1_Port4 );
ReefAngel.DayLights( Box1_Port5 );
ReefAngel.ActinicLights( Box1_Port6 );
ReefAngel.StandardHeater( Box1_Port7 );
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (now()%(2*60*60)<(1*60*60)?80:35);
ReefAngel.PWM.SetActinic (now()%(2*60*60)<(1*60*60)?35:90);
}
else
{
ReefAngel.PWM.SetDaylight (45);
ReefAngel.PWM.SetActinic (45);
}
if (ReefAngel.DisplayedMenu==FEEDING_MODE)
{
ReefAngel.PWM.SetActinic(30);
ReefAngel.PWM.SetDaylight(30);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.AddWifi();
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph( 5, 5 );
}
#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 <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
// Ports toggled in Feeding Mode
ReefAngel.FeedingModePorts = 0;
ReefAngel.FeedingModePortsE[0] = 0;
// Ports toggled in Water Change Mode
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit;
ReefAngel.WaterChangePortsE[0] = 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 = Port2Bit | Port7Bit;
ReefAngel.OverheatShutoffPortsE[0] = Port7Bit;
// Use T1 probe as temperature and overheat functions
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
// Ports that are always on
ReefAngel.Relay.On( Port2 );
ReefAngel.Relay.On( Port8 );
////// Place additional initialization code below here
////// Place additional initialization code above here
}
void loop()
{
ReefAngel.StandardATO( Port1 );
ReefAngel.MoonLights( Port3 );
ReefAngel.Wavemaker1( Port5 );
ReefAngel.Wavemaker1( Port6 );
ReefAngel.StandardHeater( Port7 );
ReefAngel.DayLights( Box1_Port1 );
ReefAngel.ActinicLights( Box1_Port2 );
ReefAngel.DayLights( Box1_Port3 );
ReefAngel.ActinicLights( Box1_Port4 );
ReefAngel.DayLights( Box1_Port5 );
ReefAngel.ActinicLights( Box1_Port6 );
ReefAngel.StandardHeater( Box1_Port7 );
////// Place your custom code below here
if (hour()>14)
{
ReefAngel.PWM.SetDaylight (now()%(2*60*60)<(1*60*60)?80:35);
ReefAngel.PWM.SetActinic (now()%(2*60*60)<(1*60*60)?35:90);
}
else
{
ReefAngel.PWM.SetDaylight (45);
ReefAngel.PWM.SetActinic (45);
}
if (ReefAngel.DisplayedMenu==FEEDING_MODE)
{
ReefAngel.PWM.SetActinic(30);
ReefAngel.PWM.SetDaylight(30);
}
////// Place your custom code above here
// This should always be the last line
ReefAngel.AddWifi();
ReefAngel.ShowInterface();
}
void DrawCustomMain()
{
int x,y;
char text[10];
// Parameters
#if defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params,
ReefAngel.PWM.GetDaylightValue(), ReefAngel.PWM.GetActinicValue() );
#else // defined DisplayLEDPWM && ! defined RemoveAllLights
ReefAngel.LCD.DrawMonitor( 15, 62, ReefAngel.Params );
#endif // defined DisplayLEDPWM && ! defined RemoveAllLights
pingSerial();
// Main Relay Box
byte TempRelay = ReefAngel.Relay.RelayData;
TempRelay &= ReefAngel.Relay.RelayMaskOff;
TempRelay |= ReefAngel.Relay.RelayMaskOn;
ReefAngel.LCD.DrawOutletBox( 12, 93, TempRelay );
pingSerial();
// Relay Expansion
TempRelay = ReefAngel.Relay.RelayDataE[0];
TempRelay &= ReefAngel.Relay.RelayMaskOffE[0];
TempRelay |= ReefAngel.Relay.RelayMaskOnE[0];
ReefAngel.LCD.DrawOutletBox( 12, 107, TempRelay );
pingSerial();
// Date and Time
ReefAngel.LCD.DrawDate( 6, 122 );
pingSerial();
}
void DrawCustomGraph()
{
ReefAngel.LCD.DrawGraph( 5, 5 );
}