Question: Modify the Fading sketch code below to ramp an LED brightness exponentially. For the last fifth of the cycle max the brightness and then repeat
Modify the "Fading" sketch code below to ramp an LED brightness
exponentially. For the last fifth of the cycle max the brightness
and then repeat the cycle. Use a frequency of mHz milliHertz A general
plot of one cycle is shown below with normalized time and normalized
brightness.
int ledPin ; Pin connected to the LED
int brightness ; Initial brightness level to
int fadeAmount ; Amount to change the brightness by
void setup
Set the LED pin as an output
pinMode ledPin OUTPUT;
void loop
Set the brightness of the LED
analogWrite ledPin brightness;
Change the brightness for the next loop
brightness brightness fadeAmount;
Reverse the direction of the fade at the ends of the fade
if brightness
brightness ; Reset
Wait for milliseconds before changing the brightness again
delay;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
