

Where A2 is the first value in column A, which increases A3, A4. I tested it on my rig, and it worked beautifully. I plugged this into my spreadsheet, and made a few adjustments to make it multiply across my range of values, and came up with this: What is needed (in my opinion) is an S curve.Ī quick search on Wikipedia came up with the formula needed for an S curve. Also, if a fade-up is immediately followed by a fade-down there was a sharp noticeable spike in the intensity. What is happening is that the middle part of the fade was happening slower than the lower and higher levels.

This makes it very quick and easy to try out a new curve.Īfter a bit of playing around with LOG and SIN functions, the average of the two, and a few other things, I couldn't really get the right curve.
ARDUINO LED DIMMEN PWM CODE
I'm using pic assembler to do the fading, and so you can even get the spreadsheet to generate the assembler code with a formula ( ="retlw 0x" & DEC2HEX(A2)). I find that using a spreadsheet (I used Excel) you can play around with a set of numbers from 0 to 255, put a few formulas in the next cell, and graph them. I'm not an expert mathematician, but I know enough to generate some basic curves by combining a few functions and formulas without really knowing how they work.

Trying to guess 256 numbers to manually create a curve is not an easy task!
ARDUINO LED DIMMEN PWM FULL
trying to dim LEDs using PWM in a visibly linear way, but I want full 256 step resolution. I've been looking in to this subject over the last few days as I have the same problem.
