Modify blink without delay to stay on for 5 sec

Hi Katelin--

Are you making progress? This is not a simple project, but if come back with some code you have written you will get assistance.

There are a few parts to your project as has been explained in some of the earlier posts.

1)You can write a software pwm function which will be very similar to the throb example but will use micros() based timers to switch between the on/off intervals. You can model the standard arduino pwm by using a basic period of 2000 microseconds for 500 Hz frequency pwm. The timer in this loop needs to have two intervals which alternate depending if you are timing an on time or an off time. If you Google "blink without delay different on time and off time" you will see examples. I would recommend writing a a function which takes the duty cycle as an input parameter.

  1. You will also have to write a timer which switches between the duty cycle values passed to the pwm function. For 5 second fade time this timer will have an interval like below.
 if (millis() - lastValue >= 5000 / numLevels)

Leo talks about 32 levels, and I have used 50, where I actually pass the value of the level to the pwm duty cycle.

EDIT: Youy might attract more eyes to your project if you changed the title to something more descriptive like
"Fade LED with software pwm using blink without delay method"