A Few more Questions

Related to the development libraries, released by Curt Binder
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post 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.
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

ok, will try it.

instead of 1500, i'm going to replace it wirh 100,900.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

this worked with no kinks, TY to Roberto and Curt.
next stop LED.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: A Few more Questions

Post 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
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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()));
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post 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()));
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post 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.
Roberto.
binder
Posts: 2865
Joined: Fri Mar 18, 2011 6:20 pm
Location: Illinois
Contact:

Re: A Few more Questions

Post 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
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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()));

}
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

Good :)
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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?
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post 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.
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

ok, got the code to work.
it is epic gorgeous, lol.
i got the driver to dim upto 10%.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

Nice :)
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

You could, but it would be sharing one of the channels.
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

That function was actually made to be used with the PWM expansion module, but I guess we could convert it.
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

ok, thanks.
fishrme
Posts: 2
Joined: Tue Sep 13, 2011 11:03 am

Re: A Few more Questions

Post 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
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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 ;).
fishrme
Posts: 2
Joined: Tue Sep 13, 2011 11:03 am

Re: A Few more Questions

Post 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
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post 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.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

Roberto,
i'm getting multiple errors on the cloud.
i attached my pde, can you please check?
RA_090111_2201C.pde
(10.13 KiB) Downloaded 401 times
thanks a bunch.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

Was almost there :)
Attachments
RA_090111_2201C.pde
(9.97 KiB) Downloaded 385 times
Roberto.
cain
Posts: 81
Joined: Tue Aug 02, 2011 10:59 am

Re: A Few more Questions

Post by cain »

rimai wrote:Was almost there :)
tried it and it says sketch is too big.
rimai
Posts: 12857
Joined: Fri Mar 18, 2011 6:47 pm

Re: A Few more Questions

Post by rimai »

Can you post your ReefAngel_Features.h file?
Roberto.
Post Reply