Page 1 of 1
actinic moonlight
Posted: Tue Jan 21, 2014 9:32 pm
by thoughtiknew
i want my actinic channel (which is on dim expansion 0)to dim down and then stop at a low point and stay at that level and begin lunar simulation
i am a fair coder and am familiar arduino but i am just getting started with reef angel in fact my reef angel is not even here yet

just pre configuring some stuff in advance.
Re: actinic moonlight
Posted: Tue Jan 21, 2014 10:25 pm
by rimai
Try this:
Code: Select all
ReefAngel.PWM.SetChannel(0,PWMSlope(9,0,19,0,0,100,60,MoonPhase());
Re: actinic moonlight
Posted: Wed Jan 22, 2014 7:22 am
by thoughtiknew
where is the moonphase function located so i can review its usage
thanks in advance
Re: actinic moonlight
Posted: Wed Jan 22, 2014 8:52 am
by rimai
Globals.cpp
Re: actinic moonlight
Posted: Wed Jan 22, 2014 10:41 am
by Sacohen
Following along. Sounds like something I might want to do when I get my LED's set up.
Re: actinic moonlight
Posted: Thu Jan 23, 2014 4:21 pm
by thoughtiknew
Ok now I have the controller up and running but after three code revisions I now have decided to switch to internal memory wondering how I might accomplish this in that case
Re: actinic moonlight
Posted: Thu Jan 23, 2014 4:23 pm
by lnevo
Go on the portal and under internal memory, go through all the settings and configure what you want/need.
Run the wizard again and choose internal memory path..
Re: actinic moonlight
Posted: Thu Jan 23, 2014 4:24 pm
by lnevo
Compare that to what you have if you've already customized it so you can see how the functions work when using memory
Re: actinic moonlight
Posted: Fri Jan 24, 2014 8:31 pm
by thoughtiknew
I have already successfully changed everything but the moonlights over too the internal memory essentially I need to know how to code the moon phase function to work on my actinic channel thinking about jumping out the channel 0 and 2 then I can just run moon phase on channel 2. But I would also like to be able to have the actinic channel shutoff at a given time or a given number of hours after the lights off time providing for say 4 hours of simulated moon light and then allowing a period of no light for the tank
Furthermore for anyone that would like to set their moonlights to a maximum percentage of the dimming cycle see the code below...It would be nice if the MoonMax Value could have a internal memory location so it could be changed from the portal but havn't figured that out yet
int MoonMax = 25;
ReefAngel.PWM.SetChannel( 2, (MoonPhase()/(100/MoonMax)) );
Re: actinic moonlight
Posted: Sat Jan 25, 2014 10:47 am
by rimai
I'm not understanding what you are trying to do.
You mentioned 3 channels: Actinic, Channel 0 and Channel 2.
Which one is that you have the moonlights connected to and what are the other channels mentioned for?
Re: actinic moonlight
Posted: Sat Jan 25, 2014 12:48 pm
by thoughtiknew
Dim expansion 0 is my actinic channel
Dim expansion 1 is my daylight channel
Dim expansion 2 is my sudo moonlight channel which I created by placing a jumper from channel 2 to channel 0 ( jumpet not actually in place just theoretical at this point)
Re: actinic moonlight
Posted: Sat Jan 25, 2014 2:52 pm
by rimai
I'm still not getting it.
What is this jumper you are talking about?? A physical jumper?
What do you want to do with each channel?
Re: actinic moonlight
Posted: Sat Jan 25, 2014 3:26 pm
by thoughtiknew
Yes a physical jumper
The goal is this I want to use my actinic channel of my leds to also simulate the moon phase during the dark hours so my logic is this my actinic Chanel dims to zero sometime around 9pm at which point the moonphase function will kick in on channel 2 which is also connected to my actinic lights however instead of the moon phase returning a value between 0 and 100 I want it to return a value between 0 and moonmax.... I have all of this working in the code already only part I still need to get working is I would like my actinic channel to shut off completely 4 hours after the lights out time actinic is on port 8
Re: actinic moonlight
Posted: Sun Jan 26, 2014 8:42 am
by rimai
Don't do a physical jumper.
Looks so awful solution when you can do it easily with software.
I think this is what you want to do:
Code: Select all
ReefAngel.PWM.SetChannel(0,PWMSlope(9,0,21,0,0,100,60, (MoonPhase()/(100/MoonMax)) );
if (hour()>=1 && hour()<9) ReefAngel.PWM.SetChannel(0,0);
Re: actinic moonlight
Posted: Sun Jan 26, 2014 12:34 pm
by lnevo
+1
Re: actinic moonlight
Posted: Sun Jan 26, 2014 4:08 pm
by thoughtiknew
I had it like that at first however I am storing my values in the internal memory .... Not sure how I can accomplish it given that
Also Setting the pwm to zero doesn't shut my lights off something weird in the driver I need to shut the port off ...port 7
Is there a way I can create my own internal memory locations and how do I reference them
Re: actinic moonlight
Posted: Sun Jan 26, 2014 9:22 pm
by rimai
Use something like this:
Then, you can save the value in memory location 100 like this:
Re: actinic moonlight
Posted: Sun Jan 26, 2014 9:40 pm
by thoughtiknew
So I had a little extra time tonight and got to digging in the code ended up writing my own class adding some internal memory defines so now all I need is a call to the class and then write a value to position 364 and I am all set. Tomorrow I will clean it up and add some more comments and post it here for everyone
Last question is there a block of memory addresses that is reserved from further development?