PDE file

New members questions
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

PDE file

Post by jgriffith »

I just ordered my controller so hopefully I'll have it soon. Can I start building my file now or should I wait until I have the controller? I'm excited about getting started, but if its best to wait, I'll do that.
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

I'd suggest you start playing around with the software and building your file now. Make sure you go through the installer and get everything installed FIRST. Once you get things installed, then start playing around with the code and features you want. Even test compiling it inside Arduino (you just won't be able to upload it). This way you will get an idea on how much space is required and so forth. Plus you will be getting familiar with the code. That way, when your controller arrives you can start testing the codes and making sure things work the way you want them too.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

I installed RAGen, but it looks different. The tabs that I have are controller, features and main relay. I do not have the internal memory tab.
Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

I just opened it again and now it has two tabs: features and PDE, no internal memory. Is this because I dont have the controller yet? Can I still generate code with?
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

Go to menu Controller->Internal Memory
Roberto.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Thanks, is there a reason that it is not a separate tab like I see in the demo? When I generate a PDE file from the software, none of the values (from the internal memory) appear to come over into the Ardinuo software.

Also I dont see anywhere that I can enter the PWM slopes.
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

I moved the Internal Memory tab to be under the Controller menu to keep things a little simpler for people to use. It was confusing everybody having it as a main tab. People would set all their settings and go through the tabs, then get to the last one and hit "generate" and wonder why it was only doing the Internal Memory. So it's not because you don't have it connected to your controller. The software works independently from the controller.

The PWM slopes are not currently editable in the Internal Memory. That screen is just crammed full of stuff. I'm in the process of changing it to be something easier to navigate (like the Android App memory section). If you have RAGen add the PWM slope to the code, it uses the Standard Lights on/off times for the actual time to turn on and off. The Internal Memory file that gets generated puts in a default value for the start & end percentages and the duration. So you will have to edit the Internal Memory file manually to change those OR use one of the apps to update the values over wifi.

These are the lines you want to look for in the Internal Memory file to update and change based on your PWM slope:

Code: Select all

    InternalMemory.PWMSlopeStartD_write(15);
    InternalMemory.PWMSlopeEndD_write(128);
    InternalMemory.PWMSlopeDurationD_write(60);
    InternalMemory.PWMSlopeStartA_write(15);
    InternalMemory.PWMSlopeEndA_write(128);
    InternalMemory.PWMSlopeDurationA_write(60);
And now looking at this, I have to change the End percentages from 128 to 100.
The ones with the D at the end are for the daylight channel and the the ones with the A at the end are for the Actinic channel.

Hopefully that makes sense. RAGen is a continuous improvement and is evolving all the time as the controller changes and more stuff is added to the libraries.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

great, thanks for your help!

Hopefully my 8 month old will allow me to mess with this for a few hours on saturday...wish me luck!
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

jgriffith wrote:great, thanks for your help!

Hopefully my 8 month old will allow me to mess with this for a few hours on saturday...wish me luck!
good luck! it's not as hard as it sounds....just don't get overwhelmed with it. :)
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

My internal memory is not being written to he arduino software when I generate. When I click generate on the intrnal memory it asks me to save and I click yes. Then I go to the PDE file and click generate and it asks to save and then to launch.
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

jgriffith wrote:My internal memory is not being written to he arduino software when I generate. When I click generate on the intrnal memory it asks me to save and I click yes. Then I go to the PDE file and click generate and it asks to save and then to launch.
It does get saved into the arduino software folder. Once you launch arduino, you need to also open up the internal memory file which has a name Memory_DATESTAMP.ino (or pde). Then you can upload that file first. Once it's uploaded, then you need to upload your code file and you will be set.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Where is that file located? I cant find it in the arduino controllers
Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

oh, just watched the youtube video again. I was trying to open the file from a different location (file, open), will try again when I can get to it.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

On Arduino, if you go to menu File->Sketchbook, you will find all your generated codes in there.
Roberto.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

not sure what went wrong and why this file is so big, but this is my internal memory file with errors
// Autogenerated file by RAGen (v1.1.0.126), (03/10/2012 07:08)
// Memory_031012_0708.pde
//
// This file sets the default values to the Internal Memory
//


#include <ReefAngel_Features.h>
#include <ReefAngel_Globals.h>
#include <Time.h>
#include <OneWire.h>
#include <Phillips6610LCDInv.h>
#include <avr/pgmspace.h>
#include <ReefAngel_EEPROM.h>


Phillips6610LCDInv e;

void setup()
{
    e.lcd_init();
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
    e.lcd_BacklightOn();

    InternalMemory.MHOnHour_write(11);
    InternalMemory.MHOnMinute_write(0);
    InternalMemory.MHOffHour_write(15);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(5);
    InternalMemory.StdLightsOnHour_write(11);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(21);
    InternalMemory.StdLightsOffMinute_write(0);
    InternalMemory.DP1OnHour_write(2);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(10);
    InternalMemory.DP2Timer_write(10);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOTimeout_write(220);
    InternalMemory.ATOHighTimeout_write(60);
    InternalMemory.ATOHourInterval_write(0);
    InternalMemory.ATOHighHourInterval_write(1);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(50);
    InternalMemory.LEDPWMDaylight_write(50);
    InternalMemory.WM1Timer_write(200);
    InternalMemory.WM2Timer_write(354);
    InternalMemory.HeaterTempOn_write(780);
    InternalMemory.HeaterTempOff_write(785);
    InternalMemory.ChillerTempOn_write(810);
    InternalMemory.ChillerTempOff_write(785);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.PHMax_write(840);
    InternalMemory.PHMin_write(550);
}

void loop()
{
    // display the values
    char buf[128];
    sprintf(buf, "MH %2d:%02d-%2d:%02d,%d", InternalMemory.MHOnHour_read(), InternalMemory.MHOnMinute_read(),
                                         InternalMemory.MHOffHour_read(), InternalMemory.MHOffMinute_read(),
                                         InternalMemory.MHDelay_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "Std %2d:%02d-%2d:%02d", InternalMemory.StdLightsOnHour_read(), InternalMemory.StdLightsOnMinute_read(),
                                          InternalMemory.StdLightsOffHour_read(), InternalMemory.StdLightsOffMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "LED A: %d%% D: %d%%", InternalMemory.LEDPWMActinic_read(), InternalMemory.LEDPWMDaylight_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);
    sprintf(buf, "WM1: %ds", InternalMemory.WM1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*4, buf);
    sprintf(buf, "WM2: %ds", InternalMemory.WM2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, "F: %ds", InternalMemory.FeedingTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "S: %ds", InternalMemory.LCDTimer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, "H On: %d -> %d", InternalMemory.HeaterTempOn_read(), InternalMemory.HeaterTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*9, buf);
    sprintf(buf, "C On: %d -> %d", InternalMemory.ChillerTempOn_read(), InternalMemory.ChillerTempOff_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*10, buf);
    sprintf(buf, "PH %d - %d", InternalMemory.PHMax_read(), InternalMemory.PHMin_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*11, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);

    sprintf(buf, "OH: %dF", InternalMemory.OverheatTemp_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW, buf);
    sprintf(buf, "ATO L: %ds (%dh)", InternalMemory.ATOTimeout_read(), InternalMemory.ATOHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*2, buf);
    sprintf(buf, "ATO H: %ds (%dh)", InternalMemory.ATOHighTimeout_read(), InternalMemory.ATOHighHourInterval_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*3, buf);

    sprintf(buf, "DP1: %2d:%02d", InternalMemory.DP1OnHour_read(), InternalMemory.DP1OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*5, buf);
    sprintf(buf, " %ds", InternalMemory.DP1Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*6, buf);
    sprintf(buf, "DP2: %2d:%02d", InternalMemory.DP2OnHour_read(), InternalMemory.DP2OnMinute_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*7, buf);
    sprintf(buf, " %ds", InternalMemory.DP2Timer_read());
    e.lcd_draw_text(COLOR_BLACK, COLOR_WHITE, MENU_START_COL, MENU_START_ROW*8, buf);

    delay(10000);
    e.lcd_clear(COLOR_WHITE,0,0,132,132);
}

Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

that file being generated will only work with the 0.8.5.x version of the libraries. if you just got your controller then you will want to update your software. also that is an old version of ragen as well. it shouldn't matter though. but before you go any farther, please post your library version.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Ok, I uninstalled and reinstalled everything and maybe this file is better? How do I add options for moonlights, fuge light (I have 4 light plugs below, 2 for leds, one for moonlight and one for fuge light, I guess I need to add one more for an additional daytime light too (high noon powerful leds)), pwm slopes, and dosing pump schedules? Sorry I really did try to read a lot, but I'm kinda lost right now.
// Autogenerated file by RAGen (v1.2.1.158), (03/10/2012 14:29)
// RA_031012_1429.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 4
#define RFEXPANSION
*/


#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 <RF.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Item 1";
prog_char menu1_label[] PROGMEM = "Item 2";
prog_char menu2_label[] PROGMEM = "Item 3";
prog_char menu3_label[] PROGMEM = "Item 4";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label  };

void MenuEntry1()
{
    ReefAngel.DisplayMenuEntry("Item 1");
}
void MenuEntry2()
{
    ReefAngel.DisplayMenuEntry("Item 2");
}
void MenuEntry3()
{
    ReefAngel.DisplayMenuEntry("Item 3");
}
void MenuEntry4()
{
    ReefAngel.DisplayMenuEntry("Item 4");
}


void setup()
{
    ReefAngel.Init(); //Initialize controller
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

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

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port1);
    ReefAngel.StandardLights(Port2);
    ReefAngel.StandardLights(Port3);
    ReefAngel.StandardHeater(Port4);
    ReefAngel.StandardATO(Port5);
    ReefAngel.DosingPump1(Port6);
    ReefAngel.StandardLights(Port7);

    ReefAngel.ShowInterface();
}

Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Not sure if it matters, but I dont have my controller yet. I was just trying to figure out the code so I will be ready to go when it gets here. I ordered it a week ago so hopefully another week or so until I get it (the store said 2 week lead time)
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

Ok. With that setup, ports 1, 2, 3, & 7 will all be running on the same schedule.

If you want to do 2 ports for LEDs and have the LEDs do the PWM Slope stuff, then you will want to change the ports for the LEDs to be Always On (ReefAngel.Relay.On(port#);) inside the setup. This way the port always has power and the dimming is controlled via the PWM Slope function. So let's just say that Ports 1 & 2 are for the LEDs. Just change them inside RAGen to be Always On instead of Standard Lights. Next, you will want to enable the PWM slope function calls on the Controller Tab. It will say "Add PWMSlope function to code?" and you select YES. That will put the proper PWMSlope calls in and base the times off of the StandardLights function and the percentages off of the InternalMemory values.

All the values are controlled via the Internal Memory settings. Those settings are located under Controller --> Internal Memory. Once you configure the settings, you will click 'Generate'. That will create a Memory_TIMESTAMP.ino file for you. You will want to look at that file and adjust any of the extra values manually (PWMSlope %'s and durations for the daylight and actinic channels).

That will be enough to get you going too. The only thing I didn't address was the "high noon powerful leds". We can tackle that one later.

It's always best to start small. Do things in pieces or chunks and do a little at a time instead of it all at once...especially if it's confusing.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

The only thing I changed is the PWM slope and it has errors now, I intended them to come on at 10 and 11 and have a 2 hours slope and turn up from 15% to 55% and turn off at 9 and 10, but not sure if thats what I did. So how does it know which ports to use the PWM slope on? And how do I chage the "standard lights" to come on at different times (my non-dimmable moonlights to come on for 2 hours before after main lights, and the fuge lights to come on when main lights are off)?

// Autogenerated file by RAGen (v1.2.1.158), (03/11/2012 09:48)
// RA_031112_0948.ino
//
// This version designed for v0.9.0 or later

/* The following features are enabled for this File: 
#define DateTimeSetup
#define VersionMenu
#define DisplayLEDPWM
#define wifi
#define WDT
#define CUSTOM_MENU
#define CUSTOM_MENU_ENTRIES 4
#define RFEXPANSION
*/


#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 <RF.h>
#include <ReefAngel.h>

#include <avr/pgmspace.h>
prog_char menu0_label[] PROGMEM = "Item 1";
prog_char menu1_label[] PROGMEM = "Item 2";
prog_char menu2_label[] PROGMEM = "Item 3";
prog_char menu3_label[] PROGMEM = "Item 4";
PROGMEM const char *menu_items[] = {
menu0_label, menu1_label, menu2_label, menu3_label  };

void MenuEntry1()
{
    ReefAngel.DisplayMenuEntry("Item 1");
}
void MenuEntry2()
{
    ReefAngel.DisplayMenuEntry("Item 2");
}
void MenuEntry3()
{
    ReefAngel.DisplayMenuEntry("Item 3");
}
void MenuEntry4()
{
    ReefAngel.DisplayMenuEntry("Item 4");
}


void setup()
{
    ReefAngel.Init(); //Initialize controller
    ReefAngel.InitMenu(pgm_read_word(&(menu_items[0])),SIZE(menu_items));

    // Ports that are always on
    ReefAngel.Relay.On(Port1);
    ReefAngel.Relay.On(Port2);
}

void loop()
{
    // Specific functions
    ReefAngel.StandardLights(Port3);
    ReefAngel.StandardLights(Port4);
    ReefAngel.StandardLights(Port5);
    ReefAngel.DosingPump1(Port6);
    ReefAngel.StandardATO(Port7);
    ReefAngel.StandardHeater(Port8);

    ReefAngel.PWM.ActinicPWMSlope(10,0,22,0,15,55,120,15);
    ReefAngel.PWM.DaylightPWMSlope(11,0,21,0,15,55,120,15);

    ReefAngel.ShowInterface();
}

Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Also how do I configure the dosing pump, I would like to run it for 10 mintues at a time once an hour from 1am to 7 am.

This is my IM file
// Autogenerated file by RAGen (v1.2.1.158), (03/11/2012 10:09)
// Memory_031112_1009.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(8);
    InternalMemory.MHOnMinute_write(0);
    InternalMemory.MHOffHour_write(15);
    InternalMemory.MHOffMinute_write(0);
    InternalMemory.MHDelay_write(5);
    InternalMemory.StdLightsOnHour_write(11);
    InternalMemory.StdLightsOnMinute_write(0);
    InternalMemory.StdLightsOffHour_write(21);
    InternalMemory.StdLightsOffMinute_write(0);
    InternalMemory.DP1OnHour_write(1);
    InternalMemory.DP1OnMinute_write(0);
    InternalMemory.DP2OnHour_write(22);
    InternalMemory.DP2OnMinute_write(30);
    InternalMemory.DP1Timer_write(120);
    InternalMemory.DP2Timer_write(10);
    InternalMemory.DP1RepeatInterval_write(60);
    InternalMemory.DP2RepeatInterval_write(60);
    InternalMemory.ATOTimeout_write(220);
    InternalMemory.ATOHighTimeout_write(60);
    InternalMemory.ATOHourInterval_write(1);
    InternalMemory.ATOHighHourInterval_write(0);
    InternalMemory.FeedingTimer_write(900);
    InternalMemory.LCDTimer_write(600);
    InternalMemory.LEDPWMActinic_write(50);
    InternalMemory.LEDPWMDaylight_write(50);
    InternalMemory.WM1Timer_write(200);
    InternalMemory.WM2Timer_write(354);
    InternalMemory.HeaterTempOn_write(780);
    InternalMemory.HeaterTempOff_write(785);
    InternalMemory.ChillerTempOn_write(810);
    InternalMemory.ChillerTempOff_write(785);
    InternalMemory.OverheatTemp_write(1500);
    InternalMemory.PHMax_write(840);
    InternalMemory.PHMin_write(550);
    InternalMemory.SalMax_write(2550);
    InternalMemory.RFMode_write(Constant);
    InternalMemory.RFSpeed_write(140);
    InternalMemory.RFDuration_write(8);
    InternalMemory.RFDuration_write(8);
    InternalMemory.PWMSlopeStartD_write(15);
    InternalMemory.PWMSlopeEndD_write(128);
    InternalMemory.PWMSlopeDurationD_write(60);
    InternalMemory.PWMSlopeStartA_write(15);
    InternalMemory.PWMSlopeEndA_write(128);
    InternalMemory.PWMSlopeDurationA_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);
}
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

Change this:

Code: Select all

    ReefAngel.PWM.ActinicPWMSlope(10,0,22,0,15,55,120,15);
    ReefAngel.PWM.DaylightPWMSlope(11,0,21,0,15,55,120,15);
To this:

Code: Select all

    ReefAngel.PWM.SetActinic(PWMSlope(10,0,22,0,15,55,120,15));
    ReefAngel.PWM.SetDaylight(PWMSlope(11,0,21,0,15,55,120,15));
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

Assuming Port3 is main lights. Port4 is moonlighs and port5 is fuge, replace this:

Code: Select all

    ReefAngel.StandardLights(Port4);
    ReefAngel.StandardLights(Port5);
With this:

Code: Select all

    ReefAngel.StandardLights(Port4,120); //120 minutes before and after Port3
    ReefAngel.MoonLights(Port5); // Inverse cycle of Port3
Roberto.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

For the doser, try this:
Replace this:

Code: Select all

    ReefAngel.DosingPump1(Port6);
With this:

Code: Select all

  if (hour()>=1 && hour()<=7)
    ReefAngel.Relay.Set(Port6,(elapsedSecsToday(now())%3600)<600);
Roberto.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Wow, yall are great!
Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

I am using ports 1 and 2 for standard lights (1 on the longest so I'll use that one to compare to daylights being on for the inverse cycle). How does the controller know that 1 and 2 are the main lights, for the purpose of pwm dimming? I plan on doing port 3 for just 3 hours during the day for a high noon.


rimai wrote:Assuming Port3 is main lights. Port4 is moonlighs and port5 is fuge, replace this:

Code: Select all

    ReefAngel.StandardLights(Port4);
    ReefAngel.StandardLights(Port5);
With this:

Code: Select all

    ReefAngel.StandardLights(Port4,120); //120 minutes before and after Port3
    ReefAngel.MoonLights(Port5); // Inverse cycle of Port3
Image
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: PDE file

Post by binder »

jgriffith wrote:I am using ports 1 and 2 for standard lights (1 on the longest so I'll use that one to compare to daylights being on for the inverse cycle). How does the controller know that 1 and 2 are the main lights, for the purpose of pwm dimming?
It doesn't. It knows that ports 1 & 2 are always on in terms of power. That's all that it cares about there. The PWM.SetActinic() and PWM.SetDaylight() are what tells the controller to do the dimming. The dimmable drivers need power from somewhere so ports 1 & 2 power them. Then the PWM channels do the dimming. You could plug the drivers in the wall if you would rather do that....it doesn't make a difference.
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

Oh that makes sense. So I guess I can't use that code above for the moonlights and fuge lights because the main light ports are always on. So how can I simply input a time for certain ports to come on and off?
Image
jgriffith
Posts: 42
Joined: Fri Mar 02, 2012 12:39 pm

Re: PDE file

Post by jgriffith »

rimai wrote:For the doser, try this:
Replace this:

Code: Select all

    ReefAngel.DosingPump1(Port6);
With this:

Code: Select all

  if (hour()>=1 && hour()<=7)
    ReefAngel.Relay.Set(Port6,(elapsedSecsToday(now())%3600)<600);

Can you explain the above code to me? I understand the 1am to 7am part, but the last line doesnt make sense.
Image
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: PDE file

Post by rimai »

The last line uses modulo formula.
Modulo is the remainder of a division.
http://arduino.cc/en/Reference/Modulo
So, it takes elapsedSecsToday(now(), which returns the number of seconds today and divide that by 3600 seconds, which is 1 hour. Whenever you divide the number of seconds today by 3600, you will get the remainder of that division anc check if it is less than 600 seconds, which is 10 minuts.
If the verification passes, it will set the relay on Port6 on otherwise it sets to off.
You can still use the StandardLights function on your code.
Can you explain better how you have your setup so I understand what you are trying to do with the lights?
If Port1 and 2 are your LED lights, what is Port 3,4 and 5?
How's that you want their schedule to be?
Roberto.
Post Reply