Fill in the gaps

Do you have a question on how to do something.
Ask in here.
Post Reply
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Fill in the gaps

Post by lnevo »

So, my lights are dimmable now but they don't go any lower than about 7%. I'm gonna check with the par meter to see where the real cutoff is this weekend. At 5% I turn off the fixture but I have my slope go all the way to 0. The problem is the tank is really dark while the tank is still lit by the other fixture. That one shuts off 10 minutes later. What I wanted to do was use my moonlights to fill in the gap. To do this though, I wrote up this bit of code. if the current moonlight value is higher than what it would be, the. It will keep the moonlight value. If not it will map the 0-5% to 0-100% which would be 5 dimming increments of 20% each. Thanks to The new HighRes values that Alan added, it will be much smoother like 200 increments of 1/2% if I had them on the dimming module! since they are on the relax box ports, I will at least benefit with 12.5 increments of 8%.

Anyways the code..

Code: Select all

  int channelVal, moonVal;
  int LightsOffPerc=40.95*InternalMemory.read(Mem_B_LightsOffPerc);
  
  moonVal=ReefAngel.PWM.GetDaylightValueRaw();
  channelVal=ReefAngel.PWM.GetChannelValueRaw(1);
  if (channelVal<=LightsOffPerc && channelVal>moonVal) {
    ReefAngel.PWM.SetDaylightRaw(map(channelVal,0,LightsOffPerc,0,4095));
  }
  moonVal=ReefAngel.PWM.GetActinicValueRaw();
  channelVal=ReefAngel.PWM.GetChannelValueRaw(3);
  if (channelVal<=LightsOffPerc && channelVal>moonVal) {
    ReefAngel.PWM.SetActinicRaw(map(channelVal,0,LightsOffPerc,0,4095));
  }
User avatar
lnevo
Posts: 5430
Joined: Fri Jul 20, 2012 9:42 am

Re: Fill in the gaps

Post by lnevo »

Had some errors, updated the post. Tested this morning and it's working great. Have to see how it performs during tonight's sunset.. :)
Post Reply