Hi

Although I can sort out phased sinusoidal fading, with two led's 180 degrees out of phase, when one is on the other is off, how do I do I a sinusoidal fade up or fade down without cycling?

I just can't get my head around it.

Any help appreciated.

Rob

Leave the bicycle at home? What is your definition of a sinusoidal fading? Because a sine wave has a negative portion. Do you perhaps mean a sine superimposed on a fixed value, like half intensity?

If so, your answer lies very simply in the start and end points of a half wave which are at -pi/2 and +pi/2 (-90 and +90 degrees). Or something like that.

What I mean is non linear fading along a sinusoidal waveform with the wave lifted so that the lowest value of the negative portion of the wave is 0. So I want to fade from max to min or min to max to give a gradual on phase and a gradual off phase to the sequence start and end sections.

I will how ever have a play with PI/2

Thanks

Rob

That would be sin(x)/2+0.5

But a smoother function between 0 and 1 is sin(x)*sin(x) where 0<=x<=pi/2. I believe the derivative is smaller at the endpoints.

Cheers that's great, I have been out of school for too many decades, and my trig' is not as sharp as it once was.

Thanks

Rob

Actually sin(x)sin(x) is identical to sin(2x)/2+0,5

Actually sin(x)sin(x) is identical to sin(2x)/2+0,5

Back to school! Try substituting x=0.

sin(x)sin(x) = (1 - cos(2x))/2

But that is irrelevant because the human eye has logarithmic intensity response. A 10X increase in light intensity is seen as about “twice as bright”.

You can approach any waveform very fast with multimap - http://playground.arduino.cc/Main/MultiMap -

it interpolates between multiple points and it doesn't need floating point math (after you derived the tables)