Need a quick check of my code plz

New members questions
Post Reply
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

Thanks again and just to be sure its in the right place

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 <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 = Port7Bit;
      // Ports toggled in Water Change Mode
      ReefAngel.WaterChangePorts = Port7Bit;
      // Ports toggled when Lights On / Off menu entry selected
      ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
      // Ports turned off when Overheat temperature exceeded
      ReefAngel.OverheatShutoffPorts = Port6Bit | 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( 790 );


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

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

      

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

    void loop()
    {
      ReefAngel.StandardLights( Port1,9,0,20,0 );//4500
      ReefAngel.StandardLights( Port2,9,0,20,0 );//RB
      ReefAngel.StandardLights( Port3,8,0,23,0 );//Blue 1 & 2, Act, UV
      ReefAngel.StandardLights( Port4,20,0,9,0 );//ATS
      ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,20,0,15,80,15) );//4500
      ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,20,0,15,100,15) );//RB
      ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,20,0,15,100,15) );//BLUE 1 & 2
      ReefAngel.PWM.SetChannel( 3, PWMParabola(8,0,23,0,15,100,15) );//ACT & UV
      ReefAngel.PWM.SetChannel( 4, PWMParabola(9,0,20,0,15,100,15) );
      ReefAngel.PWM.SetChannel( 5, PWMSlope(20,0,10,0,15,70,20,15) );

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

      ReefAngel.Relay.Set(Port6,ReefAngel.HighATO.IsActive());//Turns off return pump if DT is flooding

                if (hour()>=9 && hour()<14)
          {
            ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
            ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
          }
          else if (hour()>=14 && hour()<18)
          {
            ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 90, 3, true));
            ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 90, 3, true));
          }
          else if (hour()>=18 && hour()<20)
          {
            ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
            ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
          }
          else
          {
            ReefAngel.PWM.SetActinic(30);
            ReefAngel.PWM.SetDaylight(30);
          }

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

      // This should always be the last line
      ReefAngel.Portal( "Mason Dixon" );
      ReefAngel.ShowInterface();
    }

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

Re: Need a quick check of my code plz

Post by lnevo »

looks ok to me.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

Got the error message "TunzeLongPulse not declared in scope"
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need a quick check of my code plz

Post by rimai »

Oh, you need to add the function to the end of your code...
These functions are not in the libraries yet.
They will be in the next release, but in the mean time, just add this to the very end of your code after the last }

Code: Select all

    byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
    {
      byte tspeed=0;
      PulseMinSpeed=constrain(PulseMinSpeed,30,100);
      PulseMaxSpeed=constrain(PulseMaxSpeed,30,100);
      tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
      if (PulseSync)
        return tspeed;
      else
        return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
    }
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

I would like for my tunze pumps to turn off for 10 mins at 10:28am, 11:58pm, 1:28pm, 258pm. How is that coded? Thanks

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 <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 = Port7Bit;
          // Ports toggled in Water Change Mode
          ReefAngel.WaterChangePorts = Port7Bit;
          // Ports toggled when Lights On / Off menu entry selected
          ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
          // Ports turned off when Overheat temperature exceeded
          ReefAngel.OverheatShutoffPorts = Port6Bit | 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( 790 );


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

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

         

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

        void loop()
        {
          ReefAngel.StandardLights( Port1,9,0,20,0 );//4500
          ReefAngel.StandardLights( Port2,9,0,20,0 );//RB
          ReefAngel.StandardLights( Port3,8,0,23,0 );//Blue 1 & 2, Act, UV
          ReefAngel.StandardLights( Port4,20,0,9,0 );//ATS
          ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,20,0,15,80,15) );//4500
          ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,20,0,15,100,15) );//RB
          ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,20,0,15,100,15) );//BLUE 1 & 2
          ReefAngel.PWM.SetChannel( 3, PWMParabola(8,0,23,0,15,100,15) );//ACT & UV
          ReefAngel.PWM.SetChannel( 4, PWMParabola(9,0,20,0,15,100,15) );
          ReefAngel.PWM.SetChannel( 5, PWMSlope(20,0,10,0,15,70,20,15) );

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

          ReefAngel.Relay.Set(Port6,ReefAngel.HighATO.IsActive());//Turns off return pump if DT is flooding

                    if (hour()>=9 && hour()<14)
              {
                ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
                ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
              }
              else if (hour()>=14 && hour()<18)
              {
                ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 90, 3, true));
                ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 90, 3, true));
              }
              else if (hour()>=18 && hour()<20)
              {
                ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
                ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
              }
              else
              {
                ReefAngel.PWM.SetActinic(30);
                ReefAngel.PWM.SetDaylight(30);
              }
        
	byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
        {
          byte tspeed=0;
          PulseMinSpeed=constrain(PulseMinSpeed,30,100);
          PulseMaxSpeed=constrain(PulseMaxSpeed,30,100);
          tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
          if (PulseSync)
            return tspeed;
          else
            return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
        }

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

          // This should always be the last line
          ReefAngel.Portal( "Mason Dixon" );
          ReefAngel.ShowInterface();
        }

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

Re: Need a quick check of my code plz

Post by rimai »

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 <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 = Port7Bit;
  // Ports toggled in Water Change Mode
  ReefAngel.WaterChangePorts = Port7Bit;
  // Ports toggled when Lights On / Off menu entry selected
  ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
  // Ports turned off when Overheat temperature exceeded
  ReefAngel.OverheatShutoffPorts = Port6Bit | 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( 790 );


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

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



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

void loop()
{
  ReefAngel.StandardLights( Port1,9,0,20,0 );//4500
  ReefAngel.StandardLights( Port2,9,0,20,0 );//RB
  ReefAngel.StandardLights( Port3,8,0,23,0 );//Blue 1 & 2, Act, UV
  ReefAngel.StandardLights( Port4,20,0,9,0 );//ATS
  ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,20,0,15,80,15) );//4500
  ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,20,0,15,100,15) );//RB
  ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,20,0,15,100,15) );//BLUE 1 & 2
  ReefAngel.PWM.SetChannel( 3, PWMParabola(8,0,23,0,15,100,15) );//ACT & UV
  ReefAngel.PWM.SetChannel( 4, PWMParabola(9,0,20,0,15,100,15) );
  ReefAngel.PWM.SetChannel( 5, PWMSlope(20,0,10,0,15,70,20,15) );

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

  ReefAngel.Relay.Set(Port6,ReefAngel.HighATO.IsActive());//Turns off return pump if DT is flooding

  if (hour()>=9 && hour()<14)
  {
    ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
    ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
  }
  else if (hour()>=14 && hour()<18)
  {
    ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 90, 3, true));
    ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 90, 3, true));
  }
  else if (hour()>=18 && hour()<20)
  {
    ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
    ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
  }
  else
  {
    ReefAngel.PWM.SetActinic(30);
    ReefAngel.PWM.SetDaylight(30);
  }
  
  if (now()%37680<600 || now()%43080<600 || now()%48480<600 || now()%53880<600)
  {
    ReefAngel.PWM.SetActinic(0);
    ReefAngel.PWM.SetDaylight(0);
  }
  ////// Place your custom code above here

  // This should always be the last line
  ReefAngel.Portal( "Mason Dixon" );
  ReefAngel.ShowInterface();
}

byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
{
  byte tspeed=0;
  PulseMinSpeed=constrain(PulseMinSpeed,30,100);
  PulseMaxSpeed=constrain(PulseMaxSpeed,30,100);
  tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
  if (PulseSync)
    return tspeed;
  else
    return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
}
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

thanks, another question, i was just going through the sunrise/sunset tutorial

does this need to be part of my code?

Code: Select all

Expansion Code Header

// This is just how we are going to reference the PWM expansion ports within the code.
// You can change the labels if you would like, just as long as they are changed all throughout the code too.
#define LEDPWM0 0
#define LEDPWM1 1
#define LEDPWM2 2
#define LEDPWM3 3
#define LEDPWM4 4
#define LEDPWM5 5

// Initial values to all 6 channels at startup. They will always be 0.
byte PWMChannel[]={
  0,0,0,0,0,0};

//End of PWM Expansion Code Header
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need a quick check of my code plz

Post by rimai »

The code I mentioned above is already doing sunset/sunrise.
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

Roberto, can you add a bit of code to this please.


I need port 8 on my relay box to come on once every hour for 25 seconds. Otherwise it should be off. Thanks



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 <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 = Port7Bit;
      // Ports toggled in Water Change Mode
      ReefAngel.WaterChangePorts = Port7Bit;
      // Ports toggled when Lights On / Off menu entry selected
      ReefAngel.LightsOnPorts = Port1Bit | Port2Bit | Port3Bit;
      // Ports turned off when Overheat temperature exceeded
      ReefAngel.OverheatShutoffPorts = Port6Bit | 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( 790 );


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

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



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

    void loop()
    {
      ReefAngel.StandardLights( Port1,9,0,20,0 );//4500
      ReefAngel.StandardLights( Port2,9,0,20,0 );//RB
      ReefAngel.StandardLights( Port3,8,0,23,0 );//Blue 1 & 2, Act, UV
      ReefAngel.StandardLights( Port4,20,0,9,0 );//ATS
      ReefAngel.PWM.SetChannel( 0, PWMParabola(9,0,20,0,15,80,15) );//4500
      ReefAngel.PWM.SetChannel( 1, PWMParabola(9,0,20,0,15,100,15) );//RB
      ReefAngel.PWM.SetChannel( 2, PWMParabola(9,0,20,0,15,100,15) );//BLUE 1 & 2
      ReefAngel.PWM.SetChannel( 3, PWMParabola(8,0,23,0,15,100,15) );//ACT & UV
      ReefAngel.PWM.SetChannel( 4, PWMParabola(9,0,20,0,15,100,15) );
      ReefAngel.PWM.SetChannel( 5, PWMSlope(20,0,10,0,15,70,20,15) );

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

      ReefAngel.Relay.Set(Port6,ReefAngel.HighATO.IsActive());//Turns off return pump if DT is flooding

      if (hour()>=9 && hour()<14)
      {
        ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
        ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
      }
      else if (hour()>=14 && hour()<18)
      {
        ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 90, 3, true));
        ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 90, 3, true));
      }
      else if (hour()>=18 && hour()<20)
      {
        ReefAngel.PWM.SetActinic(TunzeLongPulse(30, 60, 4, true));
        ReefAngel.PWM.SetDaylight(TunzeLongPulse(30, 60, 4, true));
      }
      else
      {
        ReefAngel.PWM.SetActinic(30);
        ReefAngel.PWM.SetDaylight(30);
      }
     
      if (now()%37680<600 || now()%43080<600 || now()%48480<600 || now()%53880<600)
      {
        ReefAngel.PWM.SetActinic(0);
        ReefAngel.PWM.SetDaylight(0);
      }
      ////// Place your custom code above here

      // This should always be the last line
      ReefAngel.Portal( "Mason Dixon" );
      ReefAngel.ShowInterface();
    }

    byte TunzeLongPulse(byte PulseMinSpeed, byte PulseMaxSpeed, int PulseDuration, boolean PulseSync)
    {
      byte tspeed=0;
      PulseMinSpeed=constrain(PulseMinSpeed,30,100);
      PulseMaxSpeed=constrain(PulseMaxSpeed,30,100);
      tspeed=(now()%(PulseDuration*2)<PulseDuration?PulseMinSpeed:PulseMaxSpeed);
      if (PulseSync)
        return tspeed;
      else
        return (tspeed==PulseMinSpeed)?PulseMaxSpeed:PulseMinSpeed;
    }
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need a quick check of my code plz

Post by rimai »

Add this to your loop():

Code: Select all

ReefAngel.Relay.Set(Port8,now()%3600<25);
Roberto.
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Need a quick check of my code plz

Post by lnevo »

You could also use this:

Code: Select all

ReefAngel.DosingPumpRepeat(Port8,0,60,25);
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need a quick check of my code plz

Post by rimai »

lnevo wrote:You could also use this:

Code: Select all

ReefAngel.DosingPumpRepeat(Port8,0,60,25);
Nice :mrgreen:
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

Hi Roberto,

I'm redoing a bunch of stuff and started over with the wizard. When I went to compile it, this error message popped up

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

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


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

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

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

void loop()
{
    ReefAngel.StandardLights( Port1,12,0,22,0 );
    ReefAngel.StandardLights( Port2,13,0,20,0 );
    ReefAngel.StandardHeater( Port3,760,770 );
    ReefAngel.StandardHeater( Port4,760,770 );
    ReefAngel.StandardLights( Port5,0,0,21,0 );
    ReefAngel.DCPump.UseMemory = false;
    ReefAngel.DCPump.SetMode( Constant,50,10 );
    ReefAngel.DCPump.DaylightChannel = None;
    ReefAngel.DCPump.ActinicChannel = None;
    ////// Place your custom code below here
    

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

    // This should always be the last line
    ReefAngel.Portal( "Mason Dixon" );
    ReefAngel.ShowInterface();
}


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

Re: Need a quick check of my code plz

Post by rimai »

Do you have the relay expansion module?
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

I've just got the main relay box with the 8 outlets actually
Last edited by mason dixon on Fri Mar 07, 2014 1:42 pm, edited 1 time in total.
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: Need a quick check of my code plz

Post by rimai »

You must assign a function to at least one of the ports in the relay expansion.
Roberto.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

The wizard doesn't have a way to select that I'm not using an expansion relay box. I only have the main relay box that came with the reefangel.
mason dixon
Posts: 26
Joined: Mon May 14, 2012 6:19 am

Re: Need a quick check of my code plz

Post by mason dixon »

I figured it out, had expansion selected at the beginning of setup, sorry I'm a doofus
Post Reply