update, now error in compiling?

Post Reply
Docstach
Posts: 13
Joined: Sat May 17, 2014 9:52 pm

update, now error in compiling?

Post by Docstach »

Around June I set up a program with 2 DC wavemakers. I used a code on here suggested for an else mode. Today I opened Arduino because I wanted to change my on/off temp for my heater. When I first opened up the program it asked me to update the libraries so I did. When I went to compile the same program I am now using I now get an error? Any suggestions? Thanks, Matt

Error:

The following features were automatically added:
Watchdog Timer
Version Menu

The following features were detected:
Dimming Signal
DC Pump Control (Jebao/Tunze)
2014 Main Screen
Extra Font - Medium Size (8x8 pixels)
Standard Menu
Globals/Globals.cpp.o: In function `ElseMode(unsigned char, unsigned char, unsigned char)':
/Users/Matt/Documents/Arduino/libraries/Globals/Globals.cpp:881: multiple definition of `ElseMode(unsigned char, unsigned char, unsigned char)'
sketch_jun13a_multimode_pump_v9.cpp.o:sketch_jun13a_multimode_pump_v9.cpp:124: first defined here
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/avr/bin/../lib/gcc/avr/4.3.2/../../../../avr/bin/ld: Disabling relaxation: it will not work with multiple definitions

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.AddStandardMenu();  // Add Standard Menu

    ReefAngel.Use2014Screen();  // Let's use 2014 Screen 
    // Ports toggled in Feeding Mode
    ReefAngel.FeedingModePorts = Port1Bit | Port5Bit | Port6Bit | Port8Bit;
    // Ports toggled in Water Change Mode
    ReefAngel.WaterChangePorts = Port1Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit;
    // Ports toggled when Lights On / Off menu entry selected
    ReefAngel.LightsOnPorts = Port3Bit | Port4Bit;
    // Ports turned off when Overheat temperature exceeded
    ReefAngel.OverheatShutoffPorts = Port2Bit | Port3Bit | Port4Bit | 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( 850 );

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


    // Ports that are always on
    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.StandardATO( Port1,7200 );
    ReefAngel.StandardLights( Port2,22,0,10,0 );
    ReefAngel.StandardLights( Port3,11,0,22,15 );
    ReefAngel.StandardLights( Port4,12,0,22,0 );
    ReefAngel.StandardHeater( Port7,770,780 );
    ReefAngel.DCPump.UseMemory = false;
    
    ////// Place your custom code below here
    {
    if (hour()>=0 && hour()<6)
{
  ReefAngel.PWM.SetDaylight( ElseMode(30,10,true) ); // Else on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(30,10,false) ); // Else on sync mode
}
else if (hour()>=6 && hour()<10)
{
  ReefAngel.PWM.SetDaylight( ElseMode(40,20,true) ); // Else on sync mode
  ReefAngel.PWM.SetActinic( ElseMode(40,20,false) ); // Else on sync mode
}
else if (hour()>=10 && hour()<13)
{
  ReefAngel.PWM.SetDaylight( NutrientTransportMode(77,90,3000,true) ); // Nutrient Transport on sync mode
  ReefAngel.PWM.SetActinic( NutrientTransportMode(77,90,3000,true) ); //   Nutrient Transport on sync mode
}
else if (hour()>=13 && hour()<22)
{
  ReefAngel.PWM.SetDaylight( ShortPulseMode(0,90,800,true) ); // Short pulse at 80% with 800ms pulse on sync mode
  ReefAngel.PWM.SetActinic( ShortPulseMode(0,90,800,true) ); // Short pulse at 80% with 800ms pulse on sync mode
}
else if (hour()>=22 && hour()<=24)
{
  ReefAngel.PWM.SetDaylight( ReefCrestMode(40,20,true) ); // reefcrest at 40% hours 22-24 on sync
  ReefAngel.PWM.SetActinic( ReefCrestMode(40,20,true) ); // 
}
    }


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

    // This should always be the last line
    ReefAngel.ShowInterface();
}
byte ElseMode( byte MidPoint, byte Offset, boolean WaveSync )
{
  // Static's only initialize the first time they are called
  static unsigned long LastChange=millis();        // Set the inital time that the last change occurred
  static int Delay = random( 500, 3000);           // Set the initial delay
  static int NewSpeed = MidPoint;                  // Set the initial speed
  static int AntiSpeed = MidPoint;                 // Set the initial anti sync speed
  if ((millis()-LastChange) > Delay)               // Check if the delay has elapsed
  {
    Delay=random(500,5000);                        // If so, come up with a new delay
    int ChangeUp = random(Offset);                 // Amount to go up or down
    if (random(100)<50)                            // 50/50 chance of speed going up or going down
    {
      NewSpeed = MidPoint - ChangeUp;
      AntiSpeed = MidPoint + ChangeUp;
    }
    else
    {
      NewSpeed = MidPoint + ChangeUp;
      AntiSpeed = MidPoint - ChangeUp;
    }
    LastChange=millis();                           // Reset the time of the last change
  }
  if (WaveSync)
  {
    return NewSpeed;
  }
  else
  {
    return AntiSpeed;
  }
}
    
rimai
Posts: 12881
Joined: Fri Mar 18, 2011 6:47 pm

Re: update, now error in compiling?

Post by rimai »

Remove the entire ElseMode function at the end of your code.
It has been added to the libraries on the latest update.
Roberto.
Docstach
Posts: 13
Joined: Sat May 17, 2014 9:52 pm

Re: update, now error in compiling?

Post by Docstach »

Great, thanks!!
Post Reply