Help with day/night mode Jebao code

Do you have a question on how to do something.
Ask in here.

Posts: 1
Joined: Sun Nov 25, 2018 10:19 pm
PostPosted: Sat Jan 12, 2019 11:05 am
Hi, I've been trying to come up with a code to make the pump run at one mode and speed at day and another at night but everything I've tried just runs them constantly at the night setting I want for them, constant 25%. Any help with this will be really appreciate it. Thanks

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

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


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

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


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

void loop()
{
ReefAngel.SingleATO( true,Port1,240,0 );
ReefAngel.StandardLights( Port3,10,30,20,30 );
ReefAngel.StandardLights( Port4,10,30,20,30 );
ReefAngel.StandardHeater( Port7,790,800 );
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.DaylightChannel = Sync;
ReefAngel.DCPump.ActinicChannel = AntiSync;
if (hour()>=1000 && hour()<=2100) // Day mode between 10:00am and 9:00pm
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( LongPulse,100,25 );
}
else if (hour()>=2101 || hour()<=959) // Night mode between 9:01pm and 9:59am
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( Constant,25,0 );
}


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


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

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

Posts: 273
Joined: Fri Jul 20, 2012 7:13 am
Location: Oakley, CA
PostPosted: Sat Jan 12, 2019 4:58 pm
Try changing this section:

Code: Select all
if (hour()>=1000 && hour()<=2100) // Day mode between 10:00am and 9:00pm
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( LongPulse,100,25 );
}
else if (hour()>=2101 || hour()<=959) // Night mode between 9:01pm and 9:59am
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( Constant,25,0 );
}


to this:

Code: Select all
if (hour()>=10 && hour()<=21) // Day mode between 10:00am and 9:00pm
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( LongPulse,100,25 );
}
else
{
ReefAngel.DCPump.UseMemory = false;
ReefAngel.DCPump.SetMode( Constant,25,0 );
}

Return to How do I code ...

Who is online

Users browsing this forum: No registered users and 3 guests

cron