Introduction: LEDFader Arduino Library
Hello to all, in this article we will discuss the LEDFader library that allows us to manage some of the LED functions as the FADING without using any Delay () that would result in the total break of our tab, and then the non-use of a multitask.
The library is a free download from Github: https://github.com/jgillick/arduino-LEDFader once downloaded extract the Zip and cut the contents to C: \ Program Files (x86) \ Arduino \ libraries.
Now let us analyze the functions of this library with a simple sketch that allows you to turn on an LED gradually (fading).
Step 1: Function of This Library
First of all we include the library in our sketch:
Before void setup () function, add a line that allows you to define the name of our LED and pin it is connected:
(In this case the PIN number 3)
In the function void setup () we insert a string that invokes a method within the library that requires two parameters, Intensity and Duration:
(Intensity = 255 which is the maximum and Duration = 3000ms or 3 Seconds)
At this point in the void loop () we have to add a line that allows you to update it according to how the LED status has been set:
The sketch is finished and once uploaded to the Arduino you will see that the LED connected to PIN 3 will come on gradually but without the use of Delay () and then without pause.
Step 2: The Sketch
We have a be nice policy.
Please be positive and constructive.