Page 2 of 3
Re: A Few more Questions
Posted: Tue Sep 06, 2011 8:05 pm
by rimai
Ok, let's try this line then:
Code: Select all
ReefAngel.Timer[1].SetInterval(random(100,900));
It could be that the random number generated was 0, which would prevent the timer to trigger again.
So, let's make sure that the number is more than 0.
The line above will randomize the number between 100 and 900.
Re: A Few more Questions
Posted: Tue Sep 06, 2011 9:16 pm
by cain
ok, will try it.
instead of 1500, i'm going to replace it wirh 100,900.
Re: A Few more Questions
Posted: Wed Sep 07, 2011 8:32 pm
by cain
this worked with no kinks, TY to Roberto and Curt.
next stop LED.
Re: A Few more Questions
Posted: Thu Sep 08, 2011 5:46 am
by binder
cain wrote:this worked with no kinks, TY to Roberto and Curt.
next stop LED.
Sweet. I'll fix the main/original post of the code to put in a min value of say 60, so it will run for a minimum of 60 seconds.
curt
Re: A Few more Questions
Posted: Fri Sep 09, 2011 3:52 pm
by cain
can someone give me a starting code for pwm led dimming please?
sunrise
i would like actinic to turn on at 1pm, ramp upto 70% in 1.5hrs (2:30pm), then daylight turns on at 1:30pm and ramps up to 60% in 1hr (2:30pm).
sunset
actinic to ramp down from 70% to 15% from 7:30pm to 9pm, then daylight to rmap down fro 60% to 15% from 7pm to 8pm.
please edit: thanks.
// Have PWM on from 1pm to 9pm, with gradual 90 minute ramp and down for actinic, and 60 minute ramp up and down for daylight starting at the given times
// From 1pm to 2:30pm actinic will slowly ramp from 15% to 70%, 7:30pm to 9:00pm actinic will slowly ramp down from70% to 15%
// From 1:30pm to 2:30pm daylight PWM will slowly ramp from 15% to 60%, 7:00pm to 8:00pm from 60% to 15%
ReefAngel.PWM.SetActinic(PWMSlope(13,0,14,30,21,00,90,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(13,30,14,30,20,00,60,ReefAngel.PWM.GetDaylightValue()));
Re: A Few more Questions
Posted: Fri Sep 09, 2011 4:14 pm
by rimai
Code: Select all
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,90,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(13,30,20,0,15,60,60,ReefAngel.PWM.GetDaylightValue()));
Re: A Few more Questions
Posted: Fri Sep 09, 2011 4:39 pm
by cain
rimai wrote:
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,90,ReefAngel.PWM.GetActinicValue()));
please correct me, i want to learn the code so am trying to understand what the numbers mean.
13,0 = is the starting time (1pm)
21,0 = end time (9pm)
15 = starting pwm value
70 = final pwm value
90 = minutes to ramp pwm up/down
question, if you want to ramp pwm from 15% to 70% in 60 minutes and ramp down from 70%e to 15% in 90minutes, how do you write the code?
Re: A Few more Questions
Posted: Fri Sep 09, 2011 4:47 pm
by rimai
You got it.
The function works on symetrical form.
If you want to do asymmetrical, you need to create checks and split the function in two.
The first function does 60 min and the second does 90 min.
Try this:
Code: Select all
if (hour()<16)
{
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,60,ReefAngel.PWM.GetActinicValue()));
}
else
{
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,90,ReefAngel.PWM.GetActinicValue()));
}
What the code is doing, is checking if the time is before or after 4pm.
If the time is before 4pm, it will use the slope function with 60 minutes duration, otherwise it is after 4pm and it will use the slope with 90 minutes duration.
Re: A Few more Questions
Posted: Fri Sep 09, 2011 4:50 pm
by binder
cain wrote:rimai wrote:
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,90,ReefAngel.PWM.GetActinicValue()));
please correct me, i want to learn the code so am trying to understand what the numbers mean.
13,0 = is the starting time (1pm)
21,0 = end time (9pm)
15 = starting pwm value
70 = final pwm value
90 = minutes to ramp pwm up/down
question, if you want to ramp pwm from 15% to 70% in 60 minutes and ramp down from 70%e to 15% in 90minutes, how do you write the code?
If you want to learn the code, here's the actual function definition:
Code: Select all
byte PWMSlope(byte startHour, byte startMinute, byte endHour, byte endMinute, byte startPWM, byte endPWM, byte Duration, byte oldValue)
So pair up the values with the variable names mentioned above.
Also, this thread will explain things more too. The second post (the one by me) outlines the variable names and what they do.
http://forum.reefangel.com/viewtopic.php?f=12&t=16
And note that the PWM slope function is built into the libraries now.
curt
Re: A Few more Questions
Posted: Fri Sep 09, 2011 9:53 pm
by cain
how's this?
void setup()
{
randomSeed(analogRead(0));
ReefAngel.Init(); //Initialize controller
ReefAngel.PHMin=526;// 526=PH7.0
ReefAngel.PHMax=813;// 813=PH10.0
// Ports that are always on
ReefAngel.Relay.On(Port8);
ReefAngel.Timer[1].SetInterval(random(30,360));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.On(Port4);
}
void loop()
{
ReefAngel.ShowInterface();
// Specific functions
ReefAngel.StandardATO(Port1);
ReefAngel.StandardLights(Port2);
ReefAngel.MHLights(Port3);
if ( ReefAngel.Timer[1].IsTriggered() )
{
ReefAngel.Timer[1].SetInterval(random(30,360));
ReefAngel.Timer[1].Start();
ReefAngel.Relay.Toggle(Port4);
ReefAngel.Relay.Toggle(Port5);
}
ReefAngel.StandardFan(Port6);
ReefAngel.StandardHeater(Port7);
// Have PWM on from 1p to 9p, with gradual 90 minute ramp up and down for actinic, and 60 minute
ramp up and down for daylight starting at given times
// From 1pm to 2:30p, actinic will slowly ramp up from 15% to 70%, and from 1:30p to 2:30p, daylight
will slowly ramp up from 15% to 60%
// From 7:30p to 9p, actinic will slowly ramp down from 70% to 15%, and from 7p to 8p daylight
will slowly ramp down from 60% to 15%
ReefAngel.PWM.SetActinic(PWMSlope(13,0,21,0,15,70,90,ReefAngel.PWM.GetActinicValue()));
ReefAngel.PWM.SetDaylight(PWMSlope(13,30,20,0,15,60,60,ReefAngel.PWM.GetDaylightValue()));
}
Re: A Few more Questions
Posted: Fri Sep 09, 2011 9:55 pm
by rimai
Good
Re: A Few more Questions
Posted: Sat Sep 10, 2011 5:46 am
by cain
there's an AP and DP on display of the controller where you can configure in the "lights" menu, does the code in PWM PDE needs to match with that one?
which will over ride which?
if i'm going to "turn on lights" in the head controller option, can i set the AP and DP to anything i want and it will over ride the PWM code?
Re: A Few more Questions
Posted: Sat Sep 10, 2011 8:17 am
by rimai
The PWMSlope on your PDE file will always be used no matter what values you choose either on the controller or through the Client.
It's hard coded.
You will have to wait a little bit and use what Curt is coming up, which is the custom menus to create a menu that would override the PWMSlope function.
Re: A Few more Questions
Posted: Sat Sep 10, 2011 8:38 am
by cain
so if i turn on the lights on the lights menu, it will default to the max intensity in the PWM?
so if ever i want to change the intensity, i have to change the code in the PDE.
ok, got it.
Re: A Few more Questions
Posted: Sat Sep 10, 2011 6:45 pm
by cain
ok, got the code to work.
it is epic gorgeous, lol.
i got the driver to dim upto 10%.
Re: A Few more Questions
Posted: Sat Sep 10, 2011 6:46 pm
by rimai
Nice
Re: A Few more Questions
Posted: Mon Sep 12, 2011 5:14 pm
by cain
Roberto,
can i use the moonlight without buying extra pwm expansion module?
i'm using the both pwm in the relay box for my actinicled and daylight led.
Re: A Few more Questions
Posted: Mon Sep 12, 2011 6:01 pm
by rimai
You could, but it would be sharing one of the channels.
Re: A Few more Questions
Posted: Wed Sep 14, 2011 12:08 pm
by cain
can someone help me with cloud cover/ storms?
i only have 2 drivers, 1 for whites and 1 blues.
i tried searching the PDE, but i find it confusing.
Re: A Few more Questions
Posted: Wed Sep 14, 2011 2:37 pm
by rimai
That function was actually made to be used with the PWM expansion module, but I guess we could convert it.
Re: A Few more Questions
Posted: Wed Sep 14, 2011 5:01 pm
by cain
ok, thanks.
Re: A Few more Questions
Posted: Thu Sep 15, 2011 7:19 pm
by fishrme
all these codes look mind bogalling ...i dont know if i will be able to do all that ..im interested in getting a countroller ...but its very intimadating to me aaaaggggggggggggghhhhh ...lol just how easy is this
Re: A Few more Questions
Posted: Thu Sep 15, 2011 8:48 pm
by cain
fishrme wrote:all these codes look mind bogalling ...i dont know if i will be able to do all that ..im interested in getting a countroller ...but its very intimadating to me aaaaggggggggggggghhhhh ...lol just how easy is this
the controller already comes precoded, you don't need to code to use the controller out of the box.
example the wavemaker function, the function is already coded into the controller, pump 1 on for so n so minutes and then turns off, then pump 2 turns on for so n so minutes then turns off, then repeats the process. however with mine, i want it to be random number of minutes to on/off so i need the code for it.
again, you can get the controller out of the box without messing with the code. but if you want the controller to bend according to your wishes, you need to code- if you dont know how to code, just bug roberto or curt. lol
.
Re: A Few more Questions
Posted: Fri Sep 16, 2011 7:51 am
by fishrme
i have a metal halide ,vho,water return pump ,dont have the moonlight but want to add one ,lighting cooling fans ,and 3 koraellia water flow pumps,heater,skimmer....from what i gather if you have the mh bulbs you have to hook it to the computor (am i right on that ) and as far as the wave action goes well i know nothing about that feature ...i have just 3 koraellia that stay on all the time ...im not a computor expert ...is there anyone in here that is not an expert at computors but what i want to know ..how easy is it if your not an expert
Re: A Few more Questions
Posted: Sat Sep 17, 2011 11:39 pm
by cain
fishrme wrote:i have a metal halide ,vho,water return pump ,dont have the moonlight but want to add one ,lighting cooling fans ,and 3 koraellia water flow pumps,heater,skimmer....from what i gather if you have the mh bulbs you have to hook it to the computor (am i right on that ) and as far as the wave action goes well i know nothing about that feature ...i have just 3 koraellia that stay on all the time ...im not a computor expert ...is there anyone in here that is not an expert at computors but what i want to know ..how easy is it if your not an expert
do you have your RA yet?
if you got it just post here, the functions you want is pretty straightforward, i can help you myself.
bump for the cloud function pls.
Re: A Few more Questions
Posted: Sun Sep 18, 2011 8:28 am
by rimai
Re: A Few more Questions
Posted: Tue Sep 20, 2011 10:55 am
by cain
Roberto,
i'm getting multiple errors on the cloud.
i attached my pde, can you please check?
thanks a bunch.
Re: A Few more Questions
Posted: Tue Sep 20, 2011 11:22 am
by rimai
Was almost there
Re: A Few more Questions
Posted: Tue Sep 20, 2011 12:19 pm
by cain
rimai wrote:Was almost there
tried it and it says sketch is too big.
Re: A Few more Questions
Posted: Tue Sep 20, 2011 12:21 pm
by rimai
Can you post your ReefAngel_Features.h file?