Page 1 of 1

Wavemaker Function

Posted: Sat Mar 31, 2012 3:21 pm
by dpitalo
trying to add a single powerhead that will come on and off at random.

I added this to my INO

Code: Select all

ReefAngel.WavemakerRandom1(Port6,15,60);          // Turn Port6 on/off random cycles that lasts from 15 to 60 secs
and get this error.

error: 'class ReefAngelClass' has no member named 'WavemakerRandom1'

Is there something that needs to be enabled in the features file for this to work??

Re: Wavemaker Function

Posted: Sat Mar 31, 2012 4:42 pm
by rimai
Nothing need to be enabled but i does require at least v0.9.0 libraries.

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 12:48 pm
by dpitalo
Well, that would explain it. :-) So I updated the libraries and when I go to compile, I get the following error.

C:\Program Files\Reef Angel Controller\libraries\Wire\utility\twi.c: In function 'twi_init':
C:\Program Files\Reef Angel Controller\libraries\Wire\utility\twi.c:70: error: 'SDA' undeclared (first use in this function)
C:\Program Files\Reef Angel Controller\libraries\Wire\utility\twi.c:70: error: (Each undeclared identifier is reported only once
C:\Program Files\Reef Angel Controller\libraries\Wire\utility\twi.c:70: error: for each function it appears in.)
C:\Program Files\Reef Angel Controller\libraries\Wire\utility\twi.c:71: error: 'SCL' undeclared (first use in this function)

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 1:52 pm
by binder
How did you update? Did you just use the update utility?
I would suggest you using the Reef Angel Installation program because you have to use the latest arduino to get it to work.

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 2:04 pm
by dpitalo
I used the installer for version 0.9.4. Using Arduino v1.0

It's not a huge rush since my controller is up and running with the old code/libraries, but I wanted to add the wavemaker function.

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 3:35 pm
by dpitalo
I also tried loading some of the example code snip-its and compiling them and it's giving me the same error.

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 5:26 pm
by dpitalo
Ok, so I went digging through the file in question called twi.c

I have no idea what this file does, but I commented out the following two lines.

Code: Select all


digitalWrite(SDA, 1);
digitalWrite(SCL, 1);

and the sketch compiled...Before I go and upload it to my controller, how necessary are the two lines I commented out?? :-)

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 6:22 pm
by rimai
If you had to comment them, you got something else wrong.
My suggestion is rename your libraries folder to librariesold and update with http://www.reefangel.com/update
The libraries folder is located at "Documents/Arduino/libraries"

Re: Wavemaker Function

Posted: Sun Apr 01, 2012 6:42 pm
by dpitalo
did what you suggested and got the same result.

Here's the PDE.

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 <ReefAngel.h>

#define AutoTopOff        1
#define Skimmer           2
#define Port3             3
#define Heater            4
#define WM1               5
#define WM2               6
#define SeaSwirl          7
#define Return            8
/*
Ports assignment:

Port1 - Standard ATO - "http://forum.reefangel.com/viewtopic.php?f=7&t=240"
Port2 - Skimmer
Port3 - Port3
Port4 - Heater - "http://www.reefangel.com/Support.Relay-function-StandardHeater.ashx"
Port5 - Wavemaker 1
Port6 - Wavemaker 2 - "http://www.reefangel.com/Support.Activating-a-relay.ashx"
Port7 - SeaSwirl
Port8 - Return
*/

#define PWMRB1            0
#define PWMRB2            1
#define PWMRB3            2
#define PWMWT1            3
#define PWMWT2            4
#define PWMHN             5


byte PWMChannel[]={
  0,0,0,0,0,0};

void setup()
{
  ReefAngel.Init();
  ReefAngel.FeedingModePorts = Port2Bit | Port5Bit | Port6Bit | Port8Bit; // Turn off Port6 and Port8 when feeding mode is activated
  ReefAngel.WaterChangePorts = Port2Bit | Port5Bit | Port6Bit | Port7Bit | Port8Bit; // Turn off Port5, Port6, Port7 and Port8 when water change mode is activated
  ReefAngel.Relay.DelayedOn(Skimmer,2); // Turn on Port 7
  ReefAngel.Relay.On(SeaSwirl); // Turn on Port 7
  ReefAngel.Relay.On(Return); // Turn on Port 8
}

void loop()
{
  ReefAngel.StandardATO(AutoTopOff, 60);           // ATO with 60 seconds timeout
  ReefAngel.StandardHeater(Heater,788,792);    // Heater on at 77.0F and off at 78.0F
  ReefAngel.WavemakerRandom(WM2,15,60);     // Turn Port5 on/off random cycles that lasts from 15 to 60 secs
  ReefAngel.ShowInterface();
  
  if (hour()>=21 || hour()<10)
  {
    ReefAngel.PWM.SetActinic(MoonPhase());
  }
  else
  {
    ReefAngel.PWM.SetActinic(0);
  }
//************************************************************ Start of PWM Expansion Code for Slope

      PWMChannel[PWMRB2]=PWMSlope(9,30,21,20,0,95,60,PWMChannel[PWMRB2]);                   //Royal Blue - Left Bank
      PWMChannel[PWMRB3]=PWMSlope(9,50,21,40,0,95,60,PWMChannel[PWMRB3]);                   //Royal Blue - Middle Bank
      PWMChannel[PWMRB1]=PWMSlope(10,10,22,00,0,95,60,PWMChannel[PWMRB1]);                  //Royal Blue - Right Bank

      PWMChannel[PWMWT2]=PWMSlope(11,00,21,00,0,95,80,PWMChannel[PWMWT2]);                  //XP-E Cool Whites - Left Side  
      PWMChannel[PWMWT1]=PWMSlope(11,10,21,30,0,95,80,PWMChannel[PWMWT1]);                  //XP-E Cool Whites - Right Side

      PWMChannel[PWMHN]=PWMSlope(12,00,20,00,0,95,120,PWMChannel[PWMHN]);                   //XP-G Cool Whites - Left Side

      if (hour()>=21 || hour()<12)
  {
    ReefAngel.PWM.SetDaylight(0);
  }
  else
  {
    ReefAngel.PWM.SetDaylight(PWMSlope(12,00,20,30,0,95,120,ReefAngel.PWM.GetDaylightValue()));   //XP-G Cool Whites - Right Side
  }

  
  for (int a=0;a<6;a++)
  {
    ReefAngel.PWM.Expansion(a,int(2.55*PWMChannel[a])); 
  }
//************************************************************* End of PWM Expansion Code for Slope
  
  
  
}


Re: Wavemaker Function

Posted: Sun Apr 01, 2012 7:12 pm
by rimai
I just tested it and it compiles fine.
Maybe you have not uninstalled the previous version of installer.
Try uninstalling the old versions and install the new one again.

Re: Wavemaker Function

Posted: Mon Apr 02, 2012 8:09 am
by dpitalo
That fixed it.

Thanks Roberto!