Custom code, please help
Re: Custom code, please help
You must have more than those features shown on your code.
Those defines are just comments from the time the code was generated.
You must have enabled some other feature since then.
Make sure you only use those.
Those defines are just comments from the time the code was generated.
You must have enabled some other feature since then.
Make sure you only use those.
Roberto.
Re: Custom code, please help
I don't know what to do. This is all the code I have. RAgen features
wifi
date/setup
version
display ap/dp
font 8x8
this is the code i'm trying to upload:
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define FONT_8x8
*/
#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 = Port4Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port1Bit | Port2Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port4);
ReefAngel.PHMin=542;
ReefAngel.PHMax=838;
ReefAngel.TempProbe=T1_PROBE;
}
void loop()
{
ReefAngel.StandardLights(Port1,10,0,19,0);
ReefAngel.StandardLights(Port2,22,0,6,0);
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
ReefAngel.StandardATO(Port8,60);
if (hour() > 6 && hour() < 22)
{
ReefAngel.PWM.SetDaylight(PWMSlope(10,0,18,0,0,80,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(6,0,22,0,0,80,240,0));
}
else
{
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(22,0,6,0,0,80,240,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(22,0,6,0,0,80,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();
}
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);
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);
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;
}
Binary sketch size: 33,622 bytes (of a 32,256 byte maximum)
wifi
date/setup
version
display ap/dp
font 8x8
this is the code i'm trying to upload:
/* The following features are enabled for this File:
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define SIMPLE_MENU
#define FONT_8x8
*/
#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 = Port4Bit;
ReefAngel.WaterChangePorts = Port3Bit | Port1Bit | Port2Bit | Port7Bit;
ReefAngel.OverheatShutoffPorts = Port1Bit | Port2Bit | Port7Bit;
ReefAngel.LightsOnPorts = 0;
ReefAngel.Relay.On(Port3);
ReefAngel.Relay.On(Port4);
ReefAngel.PHMin=542;
ReefAngel.PHMax=838;
ReefAngel.TempProbe=T1_PROBE;
}
void loop()
{
ReefAngel.StandardLights(Port1,10,0,19,0);
ReefAngel.StandardLights(Port2,22,0,6,0);
ReefAngel.StandardFan(Port5,787,793);
ReefAngel.StandardHeater(Port7,775,785);
ReefAngel.StandardATO(Port8,60);
if (hour() > 6 && hour() < 22)
{
ReefAngel.PWM.SetDaylight(PWMSlope(10,0,18,0,0,80,180,0));
ReefAngel.PWM.SetActinic(PWMSlope(6,0,22,0,0,80,240,0));
}
else
{
ReefAngel.PWM.SetDaylight(PWMSlopeOvernight(22,0,6,0,0,80,240,0));
ReefAngel.PWM.SetActinic(PWMSlopeOvernight(22,0,6,0,0,80,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();
}
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);
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);
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;
}
Binary sketch size: 33,622 bytes (of a 32,256 byte maximum)
Re: Custom code, please help
1. I tried reloading my old code and it didn't work
2. I went to a dif laptop and tried to upload the old code ...it worked
3. I tried uploading the latest code from that laptop, it worked
4. I enabled web portal from ragen and tried to reload the code...failed...too big
5. disabled the web portal, save features..reload the code..same error...too big
The good news , your code is working..the PWMSlopeOvernight works
The bad news, I can't compile & upload the code..what to do?
..and 10.0.2.22:200/wifi page is generating massive flood of:
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
2. I went to a dif laptop and tried to upload the old code ...it worked
3. I tried uploading the latest code from that laptop, it worked
4. I enabled web portal from ragen and tried to reload the code...failed...too big
5. disabled the web portal, save features..reload the code..same error...too big
The good news , your code is working..the PWMSlopeOvernight works
The bad news, I can't compile & upload the code..what to do?
..and 10.0.2.22:200/wifi page is generating massive flood of:
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
1335312804-1335304800-1335315600-1335322800-1335333600
1335312804-1335304800-1335319200-1335319200-1335333600
Re: Custom code, please help
Sorry... My bad... I left stuff in the code that wasn't supposed to be there.
It was my debugging code
Remove these lines:
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);
To get the code to compile, open RAGen.
Go to features tab
Make sure you only have these checked:
Wifi
Watchdog Timer
Simple Menu
Version Menu
Display LED PWM
Click the save button
Now upload your code.
It was my debugging code

Remove these lines:
Serial.print(now());
Serial.print("-");
Serial.print(Start);
Serial.print("-");
Serial.print(StartD);
Serial.print("-");
Serial.print(StopD);
Serial.print("-");
Serial.println(End);
To get the code to compile, open RAGen.
Go to features tab
Make sure you only have these checked:
Wifi
Watchdog Timer
Simple Menu
Version Menu
Display LED PWM
Click the save button
Now upload your code.
Roberto.
Re: Custom code, please help
Sorry, I didn't see your last reply.
Meantime, I bought a proper router. I'll check again the wifi module in the next few days. Thanks
Meantime, I bought a proper router. I'll check again the wifi module in the next few days. Thanks
Re: Custom code, please help
I've fixed the wifi, I was able to connect the wifi module online, it takes ip, I fwd the port...but when i access either the internal IP:2000 or the external ip:2000 I get a blank page.
What am I doing wrong?
Thanks
What am I doing wrong?
Thanks
Re: Custom code, please help
Does it work when you load the wifi test code?
File->Sketchbook->Example Codes->WifiTestCode
File->Sketchbook->Example Codes->WifiTestCode
Roberto.
Re: Custom code, please help
Does the page just say "Reef Angel Web Server"? If so, that's correct. To get your data, you need IP:2000/wifid0lph1n wrote:I've fixed the wifi, I was able to connect the wifi module online, it takes ip, I fwd the port...but when i access either the internal IP:2000 or the external ip:2000 I get a blank page.
What am I doing wrong?
Thanks
Re: Custom code, please help
I reloaded the code and it works now.
The iPhone app displays the correct values, there external IP too.
But the web portal shows zero values (Check my signature)
What am I missing here?
The iPhone app displays the correct values, there external IP too.
But the web portal shows zero values (Check my signature)
What am I missing here?
Re: Custom code, please help
Good.
You need to add the Portal() function to your code now.
You need to add the Portal() function to your code now.
Code: Select all
ReefAngel.Portal("d0lph1n");
Roberto.
Re: Custom code, please help
is it possible to display the pwm values and labels on the local interface ip:2000/wifi?
Re: Custom code, please help
No, it's not currently possible. It could be done but that page hasn't been updated for a while. Roberto would have to update it on the server to change it.d0lph1n wrote:is it possible to display the pwm values and labels on the local interface ip:2000/wifi?
Re: Custom code, please help
I didn't know it's running code from the reefangel site:
<script language='javascript' src='http://www.reefangel.com/wifi/ra1.js'></script>
K. I'll be waiting for Roberto to update it. Thanks
<script language='javascript' src='http://www.reefangel.com/wifi/ra1.js'></script>
K. I'll be waiting for Roberto to update it. Thanks
Re: Custom code, please help
It's in my list to do 
I want to make it the same as the portal page

I want to make it the same as the portal page
Roberto.
Re: Custom code, please help
hey Roberto,
What's the default Actinic/Daylight PWM value outside the PWMSlop schedule or how can i set it the default value to zero. Thank you
What's the default Actinic/Daylight PWM value outside the PWMSlop schedule or how can i set it the default value to zero. Thank you
Last edited by d0lph1n on Sat Jul 28, 2012 1:31 pm, edited 1 time in total.
Re: Custom code, please help
The last parameter on the PWMSlope defines the returned value for outside the slope schedule.
Simply set it to 0.
Simply set it to 0.
Roberto.
Re: Custom code, please help
Great. This is how it's setup right now. I just wanted to make sure. Thanks
Re: Custom code, please help
I'd like to control also the port 4 (off) in this if command, please advise:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6);
It doesn't work in this format:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) ReefAngel.Relay.Off(Port4);
or
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) && ReefAngel.Relay.Off(Port4);
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6);
It doesn't work in this format:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) ReefAngel.Relay.Off(Port4);
or
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200) ReefAngel.Relay.On(Port6) && ReefAngel.Relay.Off(Port4);
Re: Custom code, please help
I think I got it:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200){ReefAngel.Relay.On(Port6); ReefAngel.Relay.Off(Port4);}
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200){ReefAngel.Relay.On(Port6); ReefAngel.Relay.Off(Port4);}
Re: Custom code, please help
yes, this should work. you must use the brackets to group the statements to be executed.d0lph1n wrote:I think I got it:
if (ReefAngel.Params.Temp[T2_PROBE] >= 1200 || ReefAngel.Params.Temp[T3_PROBE] >= 1200){ReefAngel.Relay.On(Port6); ReefAngel.Relay.Off(Port4);}
Re: Custom code, please help
I have too much par level on the blue channel at minimum Pwm value. Is it possible to lower it even more?
Re: Custom code, please help
What do you mean?
I don't think you can go lower than 0% which means no light at all.
Are you talking about the driver cutoff point?
That's a limitation of whatever driver you are using.
I heard that Steve's LED can go down to 1% and the new meanwell LPF series can also go down to 3%.
I don't think you can go lower than 0% which means no light at all.
Are you talking about the driver cutoff point?
That's a limitation of whatever driver you are using.
I heard that Steve's LED can go down to 1% and the new meanwell LPF series can also go down to 3%.
Roberto.
Re: Custom code, please help
Yeah, on 0% I still have too much light. I have no idea how to lower it.
What if I increase the number the LEDs?
Dave Fason, the guy I purchased the most of the LED parts but the drivers said the same thing that I have to change the driver since the Inventronics drivers don't go too low.
What if I increase the number the LEDs?
Dave Fason, the guy I purchased the most of the LED parts but the drivers said the same thing that I have to change the driver since the Inventronics drivers don't go too low.
Re: Custom code, please help
One small issue:
Most of the web portal values are wrong: pH, temp, fan status etc. The iPhone app displays the correct values.
Also, where can I find more web portal banner options. I'd like a smaller banner pls. Thank you
Most of the web portal values are wrong: pH, temp, fan status etc. The iPhone app displays the correct values.
Also, where can I find more web portal banner options. I'd like a smaller banner pls. Thank you
Last edited by d0lph1n on Tue Aug 14, 2012 5:53 pm, edited 1 time in total.
Re: Custom code, please help
The last time the controller sent data to the server was several hours ago.
Roberto.
Re: Custom code, please help
days ago...
I had some issues with the wifi module. How do I refresh that?
How do I put a small web portal banner?
I had some issues with the wifi module. How do I refresh that?
How do I put a small web portal banner?