Custom code, please help
Re: Custom code, please help
If you get it connected again and configured, it should show up within 5 minutes
Roberto.
Re: Custom code, please help
Still nothing, in the RA code I have only the my forum username. Do I have to add the pass too?
I added it since my portal requires security key. I hope this will fix it.
I added it since my portal requires security key. I hope this will fix it.
Re: Custom code, please help
yes, if you entered in the portal settings, you need to add it in your code too.
Roberto.
Re: Custom code, please help
Roberto, I have the following code:
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
I'd like to turn on port 3 & 4 during water change.
Please help. Thanks
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
I'd like to turn on port 3 & 4 during water change.
Please help. Thanks
Re: Custom code, please help
Do you want them on/off based on water change or they do something else too?
Roberto.
Re: Custom code, please help
just to turn them on 3& 4 when i do water change..those are led drivers.
port1&2 are the switches that move the driver from one channel of LED1/tank1 to another channel of LED2/tank2. When both switches 1&2 are off and 3&4 are on..the actinic lights from tank1&2 are on.
Aslo I have a problem..I changed the code yesterday.. and ReefAngel.StandardLights(Port4,10,0,20,0); doesn't engage port4. What am I doing wrong? Thank you
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/
#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 <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port8Bit;
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On(Port8);
ReefAngel.PHMin=560;
ReefAngel.PHMax=820;
ReefAngel.TempProbe=T1_PROBE;
}
void loop()
{
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
if (hour() > 10 && hour() < 20)
{
ReefAngel.StandardLights(Port1,11,1,19,0);
ReefAngel.StandardLights(Port3,11,0,19,0);
ReefAngel.StandardLights(Port4,10,0,20,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,0,19,0,0,0,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(10,0,20,0,0,20,180,0));
}
else
{
ReefAngel.StandardLights(Port3,20,0,6,0);
ReefAngel.StandardLights(Port4,21,0,5,0);
ReefAngel.StandardLights(Port2,21,1,5,0);
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(20,0,6,0,0,20,180,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(21,0,5,0,0,0,180,0));
}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) {ReefAngel.Relay.On(Port6);}
if (ReefAngel.Params.Temp[T2_PROBE] < 1100 && ReefAngel.Params.Temp[T3_PROBE] < 1100) {ReefAngel.Relay.Off(Port6);}
ReefAngel.ShowInterface();
ReefAngel.Portal("d0lph1n","*****");
}
byte PWMSlopeOvernight(byte startHour, byte startMinute, byte endHour, byte
endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
{
unsigned long Start = previousMidnight(now())+((unsigned long)NumMins(startHour, startMinute)*60);
if (hour()<startHour) Start-=86400;
unsigned long StartD = Start + (Duration*60);
unsigned long End = nextMidnight(now())+((unsigned long)NumMins(endHour, endMinute)*60);
if (hour()<startHour) End-=86400;
unsigned long StopD = End - (Duration*60);
if ( now() >= Start && now() <= StartD )
return constrain(map(now(), Start, StartD, startPWM, endPWM),startPWM,
endPWM);
else if ( now() >= StopD && now() <= End )
{
byte v = constrain(map(now(), StopD, End, startPWM, endPWM),startPWM,
endPWM);
return endPWM-v+startPWM;
}
else if ( now() > StartD && now() < StopD )
return endPWM;
return oldValue;
}
=====
memory
// Autogenerated file by RAGen (v1.2.2.171), (04/14/2012 12:05)
// Memory_041412_1205.ino
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(10);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(18);
InternalMemory.MHOffMinute_write(0);
InternalMemory.StdLightsOnHour_write(22);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(6);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.WM1Timer_write(200);
InternalMemory.WM2Timer_write(354);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.FeedingTimer_write(1800);
InternalMemory.LCDTimer_write(600);
InternalMemory.OverheatTemp_write(1500);
InternalMemory.LEDPWMDaylight_write(0);
InternalMemory.LEDPWMActinic_write(0);
InternalMemory.HeaterTempOn_write(778);
InternalMemory.HeaterTempOff_write(785);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.ATOTimeout_write(60);
InternalMemory.PHMax_write(820);
InternalMemory.PHMin_write(560);
InternalMemory.MHDelay_write(5);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.DP1RepeatInterval_write(0);
InternalMemory.DP2RepeatInterval_write(0);
InternalMemory.SalMax_write(2550);
InternalMemory.PWMSlopeStartD_write(0);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(180);
InternalMemory.PWMSlopeStartA_write(0);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(180);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(0);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(0);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(0);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(0);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(0);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(0);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
InternalMemory.IMCheck_write(0x5241494D);
}
void loop()
{
// display success screen
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, " RA code file");
delay(5000);
}
port1&2 are the switches that move the driver from one channel of LED1/tank1 to another channel of LED2/tank2. When both switches 1&2 are off and 3&4 are on..the actinic lights from tank1&2 are on.
Aslo I have a problem..I changed the code yesterday.. and ReefAngel.StandardLights(Port4,10,0,20,0); doesn't engage port4. What am I doing wrong? Thank you
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/
#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 <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port1Bit | Port2Bit | Port8Bit;
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On(Port8);
ReefAngel.PHMin=560;
ReefAngel.PHMax=820;
ReefAngel.TempProbe=T1_PROBE;
}
void loop()
{
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
if (hour() > 10 && hour() < 20)
{
ReefAngel.StandardLights(Port1,11,1,19,0);
ReefAngel.StandardLights(Port3,11,0,19,0);
ReefAngel.StandardLights(Port4,10,0,20,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,0,19,0,0,0,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(10,0,20,0,0,20,180,0));
}
else
{
ReefAngel.StandardLights(Port3,20,0,6,0);
ReefAngel.StandardLights(Port4,21,0,5,0);
ReefAngel.StandardLights(Port2,21,1,5,0);
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(20,0,6,0,0,20,180,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(21,0,5,0,0,0,180,0));
}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) {ReefAngel.Relay.On(Port6);}
if (ReefAngel.Params.Temp[T2_PROBE] < 1100 && ReefAngel.Params.Temp[T3_PROBE] < 1100) {ReefAngel.Relay.Off(Port6);}
ReefAngel.ShowInterface();
ReefAngel.Portal("d0lph1n","*****");
}
byte PWMSlopeOvernight(byte startHour, byte startMinute, byte endHour, byte
endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
{
unsigned long Start = previousMidnight(now())+((unsigned long)NumMins(startHour, startMinute)*60);
if (hour()<startHour) Start-=86400;
unsigned long StartD = Start + (Duration*60);
unsigned long End = nextMidnight(now())+((unsigned long)NumMins(endHour, endMinute)*60);
if (hour()<startHour) End-=86400;
unsigned long StopD = End - (Duration*60);
if ( now() >= Start && now() <= StartD )
return constrain(map(now(), Start, StartD, startPWM, endPWM),startPWM,
endPWM);
else if ( now() >= StopD && now() <= End )
{
byte v = constrain(map(now(), StopD, End, startPWM, endPWM),startPWM,
endPWM);
return endPWM-v+startPWM;
}
else if ( now() > StartD && now() < StopD )
return endPWM;
return oldValue;
}
=====
memory
// Autogenerated file by RAGen (v1.2.2.171), (04/14/2012 12:05)
// Memory_041412_1205.ino
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(10);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(18);
InternalMemory.MHOffMinute_write(0);
InternalMemory.StdLightsOnHour_write(22);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(6);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.WM1Timer_write(200);
InternalMemory.WM2Timer_write(354);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.FeedingTimer_write(1800);
InternalMemory.LCDTimer_write(600);
InternalMemory.OverheatTemp_write(1500);
InternalMemory.LEDPWMDaylight_write(0);
InternalMemory.LEDPWMActinic_write(0);
InternalMemory.HeaterTempOn_write(778);
InternalMemory.HeaterTempOff_write(785);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.ATOTimeout_write(60);
InternalMemory.PHMax_write(820);
InternalMemory.PHMin_write(560);
InternalMemory.MHDelay_write(5);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.DP1RepeatInterval_write(0);
InternalMemory.DP2RepeatInterval_write(0);
InternalMemory.SalMax_write(2550);
InternalMemory.PWMSlopeStartD_write(0);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(180);
InternalMemory.PWMSlopeStartA_write(0);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(180);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(0);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(0);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(0);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(0);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(0);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(0);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
InternalMemory.IMCheck_write(0x5241494D);
}
void loop()
{
// display success screen
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, " RA code file");
delay(5000);
}
Re: Custom code, please help
Try this:
Code: Select all
if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE)
ReefAngel.Relay.RelayMaskOn|= Port3Bit |Port4Bit;
else
ReefAngel.Relay.RelayMaskOn&= ~(Port3Bit |Port4Bit);
Roberto.
Re: Custom code, please help
rimai wrote:Try this:Code: Select all
if (ReefAngel.DisplayedMenu==WATERCHANGE_MODE) ReefAngel.Relay.RelayMaskOn|= Port3Bit |Port4Bit; else ReefAngel.Relay.RelayMaskOn&= ~(Port3Bit |Port4Bit);
Is it going to fix the other problem too of port 4 not turning on at 10am?
Re: Custom code, please help
The code you posted changes at 11am not 10am.
>10 means anything greater than 10, which would be 11.
If you want including 10, you need to use >=10
>10 means anything greater than 10, which would be 11.
If you want including 10, you need to use >=10
Roberto.
Re: Custom code, please help
wow, thanks a lot, now it makes sense why everything started to work at 11am.rimai wrote:The code you posted changes at 11am not 10am.
>10 means anything greater than 10, which would be 11.
If you want including 10, you need to use >=10

Re: Custom code, please help
Hello Roberto, I'd like to connect the relay expansion module. I couldn't find a newer version of the user manual. What new lines of code do I have to add to activate it, how do I control the new plugs?
Re: Custom code, please help
Just use them the same way, but you must reference them with Box1_ in front of the port.
Like this:
Like this:
Code: Select all
ReefAngel.Relay.On(Box1_Port1);
Roberto.
Re: Custom code, please help
Do I have to open RA and follow the instructions " You need to place the provided jumpers to the SDA and SCL pins."
Re: Custom code, please help
If the jumpers are not there, yes.
Recent boards are coming with those pre-installed.
Recent boards are coming with those pre-installed.
Roberto.
Re: Custom code, please help
it's a Unit 6.1, it has only the RST jumper is pre-installed, the others are empty
Re: Custom code, please help
I was able to manage it. Thx.
Now, for dosing purposes, is it possible to control the relay port in seconds?
Now, for dosing purposes, is it possible to control the relay port in seconds?
Re: Custom code, please help
You don't need to mess with your current code.
You can generate a code with just one port and see how the function works, then copy and paste in your current code.
You can generate a code with just one port and see how the function works, then copy and paste in your current code.
Roberto.
Re: Custom code, please help
I've dled the latest RA for windows.
I've reloaded the mem code and the RA code and it displays the following error:
"No internal memory found"
What am I doing wrong:
===
// Autogenerated file by RAGen (v1.2.2.171), (04/14/2012 12:05)
// Memory_041412_1205.ino
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(10);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(18);
InternalMemory.MHOffMinute_write(0);
InternalMemory.StdLightsOnHour_write(22);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(6);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.WM1Timer_write(200);
InternalMemory.WM2Timer_write(354);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.OverheatTemp_write(830);
InternalMemory.LEDPWMDaylight_write(0);
InternalMemory.LEDPWMActinic_write(0);
InternalMemory.HeaterTempOn_write(778);
InternalMemory.HeaterTempOff_write(785);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.ATOTimeout_write(60);
InternalMemory.PHMax_write(860);
InternalMemory.PHMin_write(537);
InternalMemory.MHDelay_write(5);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.DP1RepeatInterval_write(0);
InternalMemory.DP2RepeatInterval_write(0);
InternalMemory.SalMax_write(2550);
InternalMemory.PWMSlopeStartD_write(0);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(180);
InternalMemory.PWMSlopeStartA_write(0);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(180);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(15);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(15);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(15);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(15);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(15);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(15);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
InternalMemory.IMCheck_write(0x5241494D);
}
void loop()
{
// display success screen
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, " RA code file");
delay(5000);
}
===
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/
#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 <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port8Bit;
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );
ReefAngel.PHMin = 537;
ReefAngel.PHMax = 860;
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
}
void loop()
{
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
ReefAngel.DosingPumpRepeat(Box1_Port1,0,120,2);
ReefAngel.DosingPumpRepeat(Box1_Port1,1,120,2);
if (hour() >= 10 && hour() < 20)
{
ReefAngel.StandardLights(Port1,11,1,19,0);
ReefAngel.StandardLights(Port3,11,0,19,0);
ReefAngel.StandardLights(Port4,10,0,19,59);
ReefAngel.StandardLights(Box1_Port3,11,0,19,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,0,19,0,0,0,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(10,0,19,59,0,20,180,0));
}
else
{
ReefAngel.StandardLights(Port3,20,0,6,0);
ReefAngel.StandardLights(Port4,21,0,5,0);
ReefAngel.StandardLights(Port2,21,1,5,0);
ReefAngel.StandardLights(Box1_Port4,21,0,5,0);
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(20,0,6,0,0,20,180,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(21,0,5,0,0,0,180,0));
}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) {ReefAngel.Relay.On(Port6);}
if (ReefAngel.Params.Temp[T2_PROBE] < 1100 && ReefAngel.Params.Temp[T3_PROBE] < 1100) {ReefAngel.Relay.Off(Port6);}
ReefAngel.ShowInterface();
ReefAngel.Portal("d0lph1n","******");
}
byte PWMSlopeOvernight(byte startHour, byte startMinute, byte endHour, byte
endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
{
unsigned long Start = previousMidnight(now())+((unsigned long)NumMins(startHour, startMinute)*60);
if (hour()<startHour) Start-=86400;
unsigned long StartD = Start + (Duration*60);
unsigned long End = nextMidnight(now())+((unsigned long)NumMins(endHour, endMinute)*60);
if (hour()<startHour) End-=86400;
unsigned long StopD = End - (Duration*60);
if ( now() >= Start && now() <= StartD )
return constrain(map(now(), Start, StartD, startPWM, endPWM),startPWM,
endPWM);
else if ( now() >= StopD && now() <= End )
{
byte v = constrain(map(now(), StopD, End, startPWM, endPWM),startPWM,
endPWM);
return endPWM-v+startPWM;
}
else if ( now() > StartD && now() < StopD )
return endPWM;
return oldValue;
}
I've reloaded the mem code and the RA code and it displays the following error:
"No internal memory found"
What am I doing wrong:
===
// Autogenerated file by RAGen (v1.2.2.171), (04/14/2012 12:05)
// Memory_041412_1205.ino
//
// This file sets the default values to the Internal Memory
//
#include <ReefAngel_Features.h>
#include <Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <RA_NokiaLCD.h>
#include <avr/pgmspace.h>
#include <InternalEEPROM.h>
#include <Wire.h>
#include <Memory.h>
RA_NokiaLCD e;
void setup()
{
e.Init();
e.Clear(COLOR_WHITE,0,0,132,132);
e.BacklightOn();
InternalMemory.MHOnHour_write(10);
InternalMemory.MHOnMinute_write(0);
InternalMemory.MHOffHour_write(18);
InternalMemory.MHOffMinute_write(0);
InternalMemory.StdLightsOnHour_write(22);
InternalMemory.StdLightsOnMinute_write(0);
InternalMemory.StdLightsOffHour_write(6);
InternalMemory.StdLightsOffMinute_write(0);
InternalMemory.WM1Timer_write(200);
InternalMemory.WM2Timer_write(354);
InternalMemory.DP1Timer_write(10);
InternalMemory.DP2Timer_write(10);
InternalMemory.FeedingTimer_write(900);
InternalMemory.LCDTimer_write(600);
InternalMemory.OverheatTemp_write(830);
InternalMemory.LEDPWMDaylight_write(0);
InternalMemory.LEDPWMActinic_write(0);
InternalMemory.HeaterTempOn_write(778);
InternalMemory.HeaterTempOff_write(785);
InternalMemory.ChillerTempOn_write(810);
InternalMemory.ChillerTempOff_write(785);
InternalMemory.ATOTimeout_write(60);
InternalMemory.PHMax_write(860);
InternalMemory.PHMin_write(537);
InternalMemory.MHDelay_write(5);
InternalMemory.DP1OnHour_write(20);
InternalMemory.DP1OnMinute_write(0);
InternalMemory.DP2OnHour_write(22);
InternalMemory.DP2OnMinute_write(30);
InternalMemory.ATOHourInterval_write(0);
InternalMemory.ATOHighHourInterval_write(0);
InternalMemory.ATOHighTimeout_write(60);
InternalMemory.DP1RepeatInterval_write(0);
InternalMemory.DP2RepeatInterval_write(0);
InternalMemory.SalMax_write(2550);
InternalMemory.PWMSlopeStartD_write(0);
InternalMemory.PWMSlopeEndD_write(100);
InternalMemory.PWMSlopeDurationD_write(180);
InternalMemory.PWMSlopeStartA_write(0);
InternalMemory.PWMSlopeEndA_write(100);
InternalMemory.PWMSlopeDurationA_write(180);
InternalMemory.RFMode_write(0);
InternalMemory.RFSpeed_write(100);
InternalMemory.RFDuration_write(10);
InternalMemory.PWMSlopeStart0_write(15);
InternalMemory.PWMSlopeEnd0_write(100);
InternalMemory.PWMSlopeDuration0_write(60);
InternalMemory.PWMSlopeStart1_write(15);
InternalMemory.PWMSlopeEnd1_write(100);
InternalMemory.PWMSlopeDuration1_write(60);
InternalMemory.PWMSlopeStart2_write(15);
InternalMemory.PWMSlopeEnd2_write(100);
InternalMemory.PWMSlopeDuration2_write(60);
InternalMemory.PWMSlopeStart3_write(15);
InternalMemory.PWMSlopeEnd3_write(100);
InternalMemory.PWMSlopeDuration3_write(60);
InternalMemory.PWMSlopeStart4_write(15);
InternalMemory.PWMSlopeEnd4_write(100);
InternalMemory.PWMSlopeDuration4_write(60);
InternalMemory.PWMSlopeStart5_write(15);
InternalMemory.PWMSlopeEnd5_write(100);
InternalMemory.PWMSlopeDuration5_write(60);
InternalMemory.IMCheck_write(0x5241494D);
}
void loop()
{
// display success screen
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, "Internal Memory Set");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, "Now load your");
e.DrawText(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, " RA code file");
delay(5000);
}
===
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define SIMPLE_MENU
*/
#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 <ReefAngel.h>
void setup()
{
ReefAngel.Init();
ReefAngel.FeedingModePorts = Port8Bit;
ReefAngel.WaterChangePorts = Port1Bit | Port2Bit | Port8Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On( Port8 );
ReefAngel.Relay.On( Box1_Port5 );
ReefAngel.Relay.On( Box1_Port6 );
ReefAngel.Relay.On( Box1_Port7 );
ReefAngel.Relay.On( Box1_Port8 );
ReefAngel.PHMin = 537;
ReefAngel.PHMax = 860;
ReefAngel.TempProbe = T1_PROBE;
ReefAngel.OverheatProbe = T1_PROBE;
}
void loop()
{
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
ReefAngel.DosingPumpRepeat(Box1_Port1,0,120,2);
ReefAngel.DosingPumpRepeat(Box1_Port1,1,120,2);
if (hour() >= 10 && hour() < 20)
{
ReefAngel.StandardLights(Port1,11,1,19,0);
ReefAngel.StandardLights(Port3,11,0,19,0);
ReefAngel.StandardLights(Port4,10,0,19,59);
ReefAngel.StandardLights(Box1_Port3,11,0,19,0);
ReefAngel.PWM.SetDaylight(PWMSlope(11,0,19,0,0,0,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(10,0,19,59,0,20,180,0));
}
else
{
ReefAngel.StandardLights(Port3,20,0,6,0);
ReefAngel.StandardLights(Port4,21,0,5,0);
ReefAngel.StandardLights(Port2,21,1,5,0);
ReefAngel.StandardLights(Box1_Port4,21,0,5,0);
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(20,0,6,0,0,20,180,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(21,0,5,0,0,0,180,0));
}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) {ReefAngel.Relay.On(Port6);}
if (ReefAngel.Params.Temp[T2_PROBE] < 1100 && ReefAngel.Params.Temp[T3_PROBE] < 1100) {ReefAngel.Relay.Off(Port6);}
ReefAngel.ShowInterface();
ReefAngel.Portal("d0lph1n","******");
}
byte PWMSlopeOvernight(byte startHour, byte startMinute, byte endHour, byte
endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
{
unsigned long Start = previousMidnight(now())+((unsigned long)NumMins(startHour, startMinute)*60);
if (hour()<startHour) Start-=86400;
unsigned long StartD = Start + (Duration*60);
unsigned long End = nextMidnight(now())+((unsigned long)NumMins(endHour, endMinute)*60);
if (hour()<startHour) End-=86400;
unsigned long StopD = End - (Duration*60);
if ( now() >= Start && now() <= StartD )
return constrain(map(now(), Start, StartD, startPWM, endPWM),startPWM,
endPWM);
else if ( now() >= StopD && now() <= End )
{
byte v = constrain(map(now(), StopD, End, startPWM, endPWM),startPWM,
endPWM);
return endPWM-v+startPWM;
}
else if ( now() > StartD && now() < StopD )
return endPWM;
return oldValue;
}
Re: Custom code, please help
Please load the InitialInternalMemory code
File->Sketchbook->Example Codes->InternalMemoryCode
File->Sketchbook->Example Codes->InternalMemoryCode
Roberto.
Re: Custom code, please help
It worked. This is by far the best support I've ever received. Thanks a lot.
Unfortunately, none of the relay expansion box ports has power.
The relay expansion module led is green. I connected it to the main relay via the usb cable and to the 2nd relay box via svga cable. All 3 jumpers are on.
Unfortunately, none of the relay expansion box ports has power.
The relay expansion module led is green. I connected it to the main relay via the usb cable and to the 2nd relay box via svga cable. All 3 jumpers are on.
Re: Custom code, please help
Your code looks good.
So, let's check if the controller sees the box.
Please load this:
Then, go to menu Tools-Serial Monitor and make sure you have 57600 baud.
The controller will output a lot of numbers. If it doesn't, you may need to reboot the controller with the window open.
Copy and paste the numbers here.
So, let's check if the controller sees the box.
Please load this:
Code: Select all
/**
* I2CScanner.pde -- I2C bus scanner for Arduino
*
* 2009, Tod E. Kurt, http://todbot.com/blog/
*
*/
#include "Wire.h"
extern "C" {
#include "utility/twi.h" // from Wire library, so we can do bus scanning
}
// Scan the I2C bus between addresses from_addr and to_addr.
// On each address, call the callback function with the address and result.
// If result==0, address was found, otherwise, address wasn't found
// (can use result to potentially get other status on the I2C bus, see twi.c)
// Assumes Wire.begin() has already been called
void scanI2CBus(byte from_addr, byte to_addr,
void(*callback)(byte address, byte result) )
{
byte rc;
byte data = 0; // not used, just an address to feed to twi_writeTo()
for( byte addr = from_addr; addr <= to_addr; addr++ ) {
rc = twi_writeTo(addr, &data, 0, 1, true);
callback( addr, rc );
}
}
// Called when address is found in scanI2CBus()
// Feel free to change this as needed
// (like adding I2C comm code to figure out what kind of I2C device is there)
void scanFunc( byte addr, byte result ) {
Serial.print("addr: ");
Serial.print(addr,HEX);
Serial.print( (result==0) ? " found!":" ");
Serial.print( (addr%4) ? "\t":"\n");
}
byte start_address = 1;
byte end_address = 128;
// standard Arduino setup()
void setup()
{
Wire.begin();
pinMode(7,OUTPUT);
Serial.begin(57600);
Serial.println("\nI2CScanner ready!");
Serial.print("starting scanning of I2C bus from ");
Serial.print(start_address,DEC);
Serial.print(" to ");
Serial.print(end_address,DEC);
Serial.println("...");
// start the scan, will call "scanFunc()" on result from each address
scanI2CBus( start_address, end_address, scanFunc );
Serial.println("\ndone");
}
// standard Arduino loop()
void loop()
{
// Nothing to do here, so we'll just blink the built-in LED
digitalWrite(7,HIGH);
delay(300);
digitalWrite(7,LOW);
delay(300);
}
The controller will output a lot of numbers. If it doesn't, you may need to reboot the controller with the window open.
Copy and paste the numbers here.
Roberto.
Re: Custom code, please help
I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80
done
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80
done
Re: Custom code, please help
The controller is not seeing the module.
It should be on #38.
Can you double check the cables and the jumpers?
It should be on #38.
Can you double check the cables and the jumpers?
Roberto.
Re: Custom code, please help
When I connect/disconnect the svga cable in the 2nd relay box, the ports have power for a fraction of a second.
Inside the relay extension, all switches are off.
Now I have this and still no power:
===
I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38 found!
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80
done
Inside the relay extension, all switches are off.
Now I have this and still no power:
===
I2CScanner ready!
starting scanning of I2C bus from 1 to 128...
addr: 1 addr: 2 addr: 3 addr: 4
addr: 5 addr: 6 addr: 7 addr: 8
addr: 9 addr: A addr: B addr: C
addr: D addr: E addr: F addr: 10
addr: 11 addr: 12 addr: 13 addr: 14
addr: 15 addr: 16 addr: 17 addr: 18
addr: 19 addr: 1A addr: 1B addr: 1C
addr: 1D addr: 1E addr: 1F addr: 20 found!
addr: 21 addr: 22 addr: 23 addr: 24
addr: 25 addr: 26 addr: 27 addr: 28
addr: 29 addr: 2A addr: 2B addr: 2C
addr: 2D addr: 2E addr: 2F addr: 30
addr: 31 addr: 32 addr: 33 addr: 34
addr: 35 addr: 36 addr: 37 addr: 38 found!
addr: 39 addr: 3A addr: 3B addr: 3C
addr: 3D addr: 3E addr: 3F addr: 40
addr: 41 addr: 42 addr: 43 addr: 44
addr: 45 addr: 46 addr: 47 addr: 48
addr: 49 addr: 4A addr: 4B addr: 4C
addr: 4D addr: 4E addr: 4F addr: 50 found!
addr: 51 addr: 52 addr: 53 addr: 54 found!
addr: 55 addr: 56 addr: 57 addr: 58
addr: 59 addr: 5A addr: 5B addr: 5C
addr: 5D addr: 5E addr: 5F addr: 60
addr: 61 addr: 62 addr: 63 addr: 64
addr: 65 addr: 66 addr: 67 addr: 68 found!
addr: 69 addr: 6A addr: 6B addr: 6C
addr: 6D addr: 6E addr: 6F addr: 70
addr: 71 addr: 72 addr: 73 addr: 74
addr: 75 addr: 76 addr: 77 addr: 78
addr: 79 addr: 7A addr: 7B addr: 7C
addr: 7D addr: 7E addr: 7F addr: 80
done
Re: Custom code, please help
It's working. It was from the imperfect connection of my jumpers inside RA.