Dimming channel 3 on 3 times in 1 day?

Do you have a question on how to do something.
Ask in here.
Post Reply
GugsJr
Posts: 68
Joined: Fri Jun 20, 2014 6:30 am

Dimming channel 3 on 3 times in 1 day?

Post by GugsJr »

I have my DIY rapid LEDs connected to my dimming module on channel 3.

Currently it goes on at 12pm - 9pm and does it's dimming cycle. from 0%-90%

I'd like it to also go on at 1% from 9pm to Midnight, and from 6am-12pm.


This way I can check on my frag tank in the morning. Is this possible?
Last edited by GugsJr on Tue Nov 14, 2017 2:30 pm, edited 2 times in total.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming channel 3 on 3 times in 1 day?

Post by rimai »

Yes, can you post your code?
Roberto.
GugsJr
Posts: 68
Joined: Fri Jun 20, 2014 6:30 am

Re: Dimming channel 3 on 3 times in 1 day?

Post by GugsJr »

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.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = 0;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port3Bit;
    // 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( Port1 );
    ReefAngel.Relay.On( Port2 );
    ReefAngel.Relay.On( Port4 );
    ReefAngel.Relay.On( Port7 );
    ReefAngel.Relay.On( Port8 );
    ReefAngel.Relay.On( Box1_Port1 );
    ReefAngel.Relay.On( Box1_Port2 );

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

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

void loop()
{
    ReefAngel.StandardHeater( Port3,770,780 );
    ReefAngel.StandardLights( Port5,12,0,21,0 );
    ReefAngel.StandardLights( Port6,21,0,12,0 );
    ReefAngel.StandardHeater( Box1_Port3,770,780 );
    ReefAngel.StandardHeater( Box1_Port5,770,780 );
    ReefAngel.StandardATO( Box1_Port6,60 );
    ReefAngel.StandardLights( Box1_Port7,21,30,16,30 );
    ReefAngel.PWM.SetChannel( 1, PWMSlope(20,45,13,15,0,50,60,0) );
    ReefAngel.PWM.SetChannel( 2, PWMSlope(20,45,13,15,0,50,60,0) );
    ReefAngel.PWM.SetChannel( 3, PWMSlope(12,0,21,0,0,24,60,0) );
    ReefAngel.PWM.SetChannel( 4, PWMSlope(12,0,21,0,0,80,60,0) );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( ReefCrest,35,10 );
    ReefAngel.DCPump.DaylightChannel = None;
    ReefAngel.DCPump.ActinicChannel = None;
    ReefAngel.DCPump.ExpansionChannel[0] = Sync;
    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
    

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

    // This should always be the last line
    ReefAngel.Portal( "GugsJr" );
    ReefAngel.DDNS( "Home" ); // Your DDNS is GugsJr-Home.myreefangel.com
    ReefAngel.ShowInterface();
}

rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Dimming channel 3 on 3 times in 1 day?

Post by rimai »

Try this:

Code: Select all

ReefAngel.PWM.SetChannel( 3, PWMSlope(12,0,21,0,0,24,60,1) );
if (hour()<6) ReefAngel.PWM.SetChannel( 3, 0);
The one at the end of the slope function is what it will be at the end of the slope instead of 0%. Then you set the channel to zero from midnight to 6am.
Roberto.
GugsJr
Posts: 68
Joined: Fri Jun 20, 2014 6:30 am

Re: Dimming channel 3 on 3 times in 1 day?

Post by GugsJr »

didn't work, ended up getting it to work with this

Code: Select all

    
if (hour()>=12 && hour()<=21) ReefAngel.PWM.SetChannel( 4, PWMSlope(12,0,21,0,0,100,60,0) );
 else if (hour()>=6 && hour()<=12) ReefAngel.PWM.SetChannel( 4, 3);
 else if (hour()>=21 && hour()<24) ReefAngel.PWM.SetChannel( 4, 3);
 else if (hour()>=0 && hour()<=1) ReefAngel.PWM.SetChannel( 4, 3); 
 else if (hour()>=1 && hour()<=6) ReefAngel.PWM.SetChannel( 4, 0);
Post Reply