urgent help, cant control relay ports and expansion relay

Share you PDE file with our community

Posts: 69
Joined: Sun Aug 04, 2013 2:29 am
PostPosted: Tue May 17, 2016 9:23 am
hi all:
i just hocked up my new relay expansion box today.
but strange thing is,
i cant control my return and skimmer, and any ports in expansion relay.
if i override port 6 in main relay box, all system would shut off.

whats wrong with my code
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>

// Define Relay Ports by Name
#define Wavepump1           1
#define ATOPump            3
#define ZeovitShake        5
#define Wavepump2          2
#define Heater             4
#define WormPump           6
#define Skimmer            7
#define Return             8

#define T5_Channel1        Box1_Port1 
#define T5_Channel2        Box1_Port3
#define T5_Channel3        Box1_Port5 
#define Co2Pump            Box1_Port4
#define Co2                Box1_Port2 
#define Wavepump3          Box1_Port6

// Define Custom Memory Locations

////// 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
    ReefAngel.AddSalinityExpansion();  // Salinity Expansion Module
    ReefAngel.AddPHExpansion();  // pH Expansion Module
   
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port2Bit;
    //ReefAngel.FeedingModePortsE[0] = Port6Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port7Bit;
    //ReefAngel.WaterChangePortsE[0] = Port6Bit;
    // Ports toggled when Lights On / Off menu entry selected
    //ReefAngel.LightsOnPortsE[0] = Port1Bit | Port3Bit | Port5Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = 0;
    // Use T1 probe as temperature and overheat functions
    ReefAngel.TempProbe = T3_PROBE;
    ReefAngel.OverheatProbe = T2_PROBE;
   
    // Feeeding and Water Change mode speed
    ReefAngel.DCPump.DaylightChannel = Sync;
    ReefAngel.DCPump.ActinicChannel = AntiSync;
    //ReefAngel.DCPump.ExpansionChannel[0] = Sync;
    //ReefAngel.DCPump.ExpansionChannel[1] = AntiSync;
    //ReefAngel.DCPump.ExpansionChannel[2] = None;
    //ReefAngel.DCPump.ExpansionChannel[3] = None;
    //ReefAngel.DCPump.ExpansionChannel[4] = None;
    //ReefAngel.DCPump.ExpansionChannel[5] = None;

   
    ReefAngel.DCPump.FeedingSpeed=0;
    ReefAngel.DCPump.WaterChangeSpeed=0;

    // Ports that are always on
    ReefAngel.Relay.On(Return);
    ReefAngel.Relay.On(Wavepump1);
    ReefAngel.Relay.On(Wavepump2);
    ReefAngel.Relay.On(Wavepump3);
    ReefAngel.Relay.On(WormPump);
    ReefAngel.Relay.On(Co2Pump);
   
    ////// Place additional initialization code below here
   
    ReefAngel.CustomLabels[0]="ReturnPump";
    ReefAngel.CustomLabels[1]="ATOPump";
    ReefAngel.CustomLabels[2]="ZeovitShake";
    ReefAngel.CustomLabels[3]="T5_Channel2";
    ReefAngel.CustomLabels[4]="Co2";
    ReefAngel.CustomLabels[5]="T5_Channel1";
    ReefAngel.CustomLabels[6]="Skimmer";
    ReefAngel.CustomLabels[7]="WavePump";

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

void loop()
{
    //single ATO
    ReefAngel.SingleATOLow(ATOPump);
    //Heater
    ReefAngel.StandardHeater(Heater);
   
    //Co2 control
    ReefAngel.CO2Control( Co2);
   
    //ZeovitShake
    if (hour()==5 && minute()==29) //shake at 5:29 AM
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==11 && minute()==26) //shake at 2:26 PM
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==18 && minute()==56) //shake at 6:56 AM
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else if (hour()==22 && minute()==29) //shake at 10:29 PM
    {
      ReefAngel.Relay.On(ZeovitShake);
    }
    else
    {
      ReefAngel.Relay.Off(ZeovitShake);
    }

   
    ReefAngel.Relay.DelayedOn(Skimmer);

    // T5 light setup
    ReefAngel.ActinicLights(T5_Channel2);
    //ReefAngel.ActinicLights(T5_Channel3);
    ReefAngel.DayLights(T5_Channel1);

    /// PHExp params to control Co2 Reactor feed pump
    //if ( ReefAngel.Params.PH < 640 ) ReefAngel.Relay.Off( Co2 ); // Reactor Feed control
    //if ( ReefAngel.Params.PH >= 645 ) ReefAngel.Relay.On( Co2 ); // Reactor Feed control
    //ReefAngel.CO2Control(Co2, InternalMemory.CO2ControlOff_read(),InternalMemory.CO2ControlOn_read(),true);

    //dosing pump setup

   
    //wave pump setup   
    if (now() % SECS_PER_DAY >= 8 * SECS_PER_HOUR && now() % SECS_PER_DAY < (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Lagoon,60,20);//Set 6105 to 60% speed with  pulse in Lagoon Mode from 9:00~9:10
        }
       
       else if (now() % SECS_PER_DAY >= (8 * SECS_PER_HOUR + 10 * SECS_PER_MIN) && now() % SECS_PER_DAY < (11 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            //ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
            ReefAngel.DCPump.SetMode(ShortPulse,65,59);
        }   
             
        else if (now() % SECS_PER_DAY >= (11 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(ReefCrest,60,20);;//Set 6105 to 55% speed with Long pulse Mode
        }
       
        else if (now() % SECS_PER_DAY >= (12 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 15 * SECS_PER_HOUR )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,55,20); //Set 6105 to 45% speed with 20ms pulse in Tidal Swell Mode
        }
       
        else if (now() % SECS_PER_DAY >= 15 * SECS_PER_HOUR  && now() % SECS_PER_DAY < (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            //ReefAngel.DCPump.SetMode(ReefCrest,60,20);//Set RW8 to 40% speed with Lagoon Pulse Mode
            ReefAngel.DCPump.SetMode(ShortPulse,65,59);
        }
       
        else if (now() % SECS_PER_DAY >= (17 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN))
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,60,20); //Set 6105 to 55% speed with 20ms pulse in Tidal Swell Mode
        }
       
        else if (now() % SECS_PER_DAY >= (18 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (19 * SECS_PER_HOUR + 00 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(ReefCrest,60,20);//Set RW8 to 40% speed with Lagoon Pulse Mode
        }   
       
        else if (now() % SECS_PER_DAY >= (19 * SECS_PER_HOUR + 0 * SECS_PER_MIN) && now() % SECS_PER_DAY < 20 * SECS_PER_HOUR )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(TidalSwell,50,20); //Set 6105 to 85% speed with 20ms pulse in Tidal Swell Mode
        }
       
        else if (now() % SECS_PER_DAY >= 20 * SECS_PER_HOUR  && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=true;
            //ReefAngel.DCPump.SetMode(ReefCrest,55,20);//Set 6105 to 70% speed with Lagoon Pulse Mode
            ReefAngel.DCPump.SetMode(ShortPulse,65,59);
        }
       
        else if (now() % SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now() % SECS_PER_DAY < (22 * SECS_PER_HOUR + 35 * SECS_PER_MIN) )
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Lagoon,70,20);//Set 6105 to 90% speed with  pulse in Lagoon Mode, dossing coral feed.
        }
               
       else
        {
            ReefAngel.DCPump.UseMemory=false;
            ReefAngel.DCPump.SetMode(Sine,40,60);
        }
       
        // Set RW-8 WaveMode
        //if (hour() >= 8 && hour() < 9)
       // {
       //     ReefAngel.PWM.SetChannel(0,GyreMode(45,75,60,true));
       //     ReefAngel.PWM.SetChannel(1,GyreMode(45,75,60,false));
       // }
       //else if (hour() >= 9 && hour() < 13)
       //{
       //     ReefAngel.PWM.SetChannel(0,TidalSwellMode(75,true));
       //     ReefAngel.PWM.SetChannel(1,TidalSwellMode(75,false));
       // }
       //else if (hour() >= 13 && hour() < 17)
       // {
       //     ReefAngel.PWM.SetChannel(0, ElseMode(60,20,true));
       //     ReefAngel.PWM.SetChannel(1, ElseMode(60,20,false));
       // }
       //else if (hour() >= 17 && hour() < 22)
       // {
       // }
       
    // Set timer when in feeding mode
   // static unsigned long feeding;
   // if (ReefAngel.DisplayedMenu==FEEDING_MODE) feeding=now();
   // if (now()-feeding< 1 *SECS_PER_HOUR) {
    // Continue NTM for the 60 minutes
   // ReefAngel.DCPump.UseMemory=false;
   // ReefAngel.DCPump.SetMode(NutrientTransport,35,30);
   // }
   
    //Autofeeder
    if ( ((hour() == 18)) && (minute() == 58) &&(second() == 30) ) ReefAngel.FeedingModeStart();
    if ( ((hour() == 9)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
    if ( ((hour() == 14)) && (minute() == 28) &&(second() == 0) ) ReefAngel.FeedingModeStart();
    //Skimmer off 1.5 hours when coral feeding.
    if (now()%SECS_PER_DAY >= (22 * SECS_PER_HOUR + 30 * SECS_PER_MIN)  && now()%SECS_PER_DAY < (23 * SECS_PER_HOUR + 0 * SECS_PER_MIN) )
    {
      ReefAngel.Relay.Off(Skimmer);
    }

    ////// Place your custom code below here
    ReefAngel.UseFlexiblePhCalibration();
  // Power Restored - Turn things back on
  // Turn off Skimmer if Return pump has been shutoff.   
  if (!ReefAngel.Relay.Status(Return)) {
      ReefAngel.Relay.Off(Skimmer);
      //ReefAngel.Relay.Off(Heater);
  }

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

    // This should always be the last line
    ReefAngel.Portal( "sesame");
    ReefAngel.DDNS("sesamehome");
    ReefAngel.ShowInterface();
}

Return to My PDE/INO file

Who is online

Users browsing this forum: No registered users and 2 guests

cron