Hi,
I am using the following code snippet in which only the declarations are omitted to fade a LED:
TIMER_Fade = millis();
STATE_Fade = 128+127*cos(2*PI/FADE_Interval*TIMER_Fade);
// sets the value (range from 0 to 255)
analogWrite(LED_Fade, STATE_Fade);
As is, this works excellent to continually fade in/fade out an LED. I am trying to add some more variables to it eg. setting the beginning/ending brightness to something other than 0 to 255 or pausing between either the fade in/fade out steps or the fade out/fade in steps (avioding Delay() and using a Millis() timer or something).
I have tried 'playing' with the COS line, but to be honest I just do not understand how this is working without a good old fashioned loop and nothing I try produces anything that gets me going in the direction that I want to take this.
If someone could give me a tip to point me in the right direction, I would be very grateful. Thanks in advance.