|02-03-2014 07:16 PM|
I'll let you know what I find.
I'm at the Arduino forum as I don't know wether to increase or decrease the frequency of the pins.
Changing is pretty straight forward.
Truthfully, I've had nothing but issues ever since I changed out the Sainsmart clone for an actual Arduino.
Who would have thought?
|02-03-2014 07:08 PM|
|02-03-2014 05:58 PM|
Ok, so I'm seriously confused now. I've been fiddling around, and I just can't get it to stop the jerky step up.
I don't understand why it's fine once, and then reverts back to stepping?
I've tried several different things: only using two channel, and I even went back to the old original sketch that I knew worked...I have video to prove it.
Now I'm down to blaming hardware as it is the only thing different since originally starting.
I went from a Sainsmart Mega to an actual Arduino Mega, and from LEDsee drivers to Meanwell LDDs.
I'm starting to question the PWM frequency of the Arduino board.
Do you think adjusting these would help?
|02-02-2014 03:34 AM|
|sketch804||Gonna follow this one!|
|01-29-2014 06:50 PM|
Oh well, new plan:
You initialize it just like the example with AddPoint() and set some generic times and intensities, let's call it InitializeLights(). The actual values don't matter, they will be overwritten anyway.
You then make a second function to set the actual values using SetPoint(), let's call it UpdateLights(). Since the channels are already set up elsewhere you only have to set the points this time, the channel creation with pins and such is not necessary. Example:
int channelNo = 0; Channels[channelNo].SetPoint(0, 8, 0, 0); Channels[channelNo].SetPoint(1, 8, 30, 255); Channels[channelNo].SetPoint(2, 20, 0, 255); Channels[channelNo].SetPoint(3, 20, 30, 0); channelNo = 1; // ... etc ...
|01-29-2014 06:02 PM|
I must be doing something wrong? It won't initialize with .SetPoint().
Using the example sketch I added 8 channels each channel has 4 periods.
It works fine with AddPoint().
I changed all periods to .SetPoint(), indexed each period 0 to 4, and then added variables risehour, risemin, color_max. With the exception of the first and last period where the intensity equals 0.
I then declared each variable with a value.
int RBlue_max =255
int rise hour = 8
And it failed to initialize. I then changed all the set points back to whole numbers to test, and it again failed to initialize using .SetPoint()
I'm missing something?? Any suggestions?
|01-28-2014 07:30 PM|
And another thing. The example uses the same fade mode as the old one, where PWM is increased in a linear fashion (fademode_linear). But due to the way we perceive light this does not look linear at all. The alternative mode (fademode_exponential) attempts to compensate for this. The fademode is chosen for each channel during initialization.
|01-28-2014 06:07 PM|
Ok. I had no issues getting the new sketch up and running as written with 7 channels on 4 periods(points).
No Steps!!! Just even smooth linear increasing!
Now the tricky part...the integration.
Just a couple of questions just to be clear.
So, something like this
Channels[channelNo].SetPoint(1, 8, 0, 0); Channels[channelNo].SetPoint(2, 8, 30, 255); Channels[channelNo].SetPoint(3, 20, 0, 255); Channels[channelNo].SetPoint(4, 20, 30, 0);
" Since you will be calling InitializeChannels several times"
Anything I need to change to call this function?
Ok. I see where it is initialized in setup().
I think I can just call that at my enter buttons on the LCD as well, so it is only called when a change is made?
|01-28-2014 09:06 AM|
|benjaf||I committed a small fix, you could not add points with their float intensity (0-1) as everything was treated like an int (0-255).|
|01-28-2014 06:39 AM|
Well the good thing is you don't really need to bother with most of the stuff in the .h and .cpp files. I think the most significant change is that you have to think of the light intensity as a chart with lines connecting a bunch of points.
Regarding the whole variable thing. Since you will be calling InitializeChannels several times you need to use SetPoint() rather than AddPoint(). The only real difference is that you need to include the point number:
Channels[channelNo].SetPoint(#, 8, 0, 0);
|01-27-2014 11:40 PM|
Lol!! Hi buddy.
Ok. So, I'm looking over the new sketch. I'm sure I will get used to it, but it is still kind of greek to me.
Before I start trying to integrate this new sketch, and since you already know what I'm trying to accomplish, do you foresee any issues I may have?
Like using variables instead of whole numbers...stuff like that.
|01-23-2014 01:45 AM|
I think you might be right about the code...actually I have no doubt you wouldn't steer me wrong.
Comfort...is pretty much the reason I haven't looked into changing to your new code.
I never had an issue with your original code. I understand it well, and then I put in all that effort to integrate the touch screen. I'm stubborn and was going to make work come hell or high water!
Honestly, I haven't even seen the new version with he exception of the snippets that have been posted.
I'll check it out...so be prepared!
Thanks for all the help mate!
|01-22-2014 07:00 PM|
I am slightly concerned that the whole schedule reading is simply too wasteful when you have that many channels. The new version should be somewhat better, but I certainly understand that you don't really want to replace it
|01-22-2014 06:05 PM|
Alas Benjaf...you were right.
I'm going to have to hook it up to the serial port and try to trouble shoot it.
I changed it back to the old calculation. The new calculation with "progress" would start the lighting, but would not fade at the scheduled time.
I also found it steps on the fade as well. It just isn't as noticeable because it does fade smoothly to a point, but once it reaches that point it steps 3 or 4 times down to zero.
I can only assume this is what's happening on the ramping. It probably steps 4 times to a certain value, and then smoothed out the rest of the way.
My new thought is perhaps the "float" math...it may be taking longer to calculate due to breaking it out of the array???
Still not sure. Bottom line the code is not happy....
The search continues. I will let you know if I discover the issue.
|01-20-2014 04:23 PM|
|Rvacinek||This is a seriously great thread to read through. keep the information flowing.|
|This thread has more than 15 replies. Click here to review the whole thread.|