Here’s the Arduino source code for second example: # include # define LED_PIN 7 # define NUM_LEDS 20 Using some “for” loops we can easily make some animations. In order to make the change happen on the LEDs we need to call the function FastLED.show(). Using the CRGB function we can set any LED to any color using three parameters of Red, Green and Blue color. Now it the main loop we can control our LEDs anyhow we want. In the setup section we just need to initialize the FastLED with the parameters with defined above. This type contains the LEDs, with three one-byte data members for each of the three Red, Green and Blue color channel. Here’s the Arduino source code for first example: # include # define LED_PIN 7 # define NUM_LEDS 20ĭesctiption: So first we need to include the FastLED library, define the pin to which the LED strip data is connected, define the number of LEDs, as well as define an array of type CRGB. As an Amazon Associate I earn from qualifying purchases. 5V 6A DC Power Supply ……………… Amazon / Banggood / AliExpressĭisclosure: These are affiliate links.Arduino Board …………………………… Amazon / Banggood / AliExpress.You can get the components needed for this example from the links below: This is an excellent and well documented library which enables easy control of the WS2812B LEDs. For programming the Arduino, we will use the FastLED library. Now as an example I will use 20 LEDs long strip, connected to the Arduino through a 330 Ohms resistor and powered with a separate 5V power supply, just as explained above.
0 Comments
Leave a Reply. |