Tags: ,

LED ribbons are made up of a succession of addressable RGB LEDs, i.e. the brightness and colour of each LED can be set independently. There are several ribbon models: single colour, non-addressable, 5 or 12V, etc. Pay attention to the model you want to use.


  • Computer
  • Arduino UNO
  • USB cable A Male to B Male
  • LED ribbon WS2812b


The LED ribbon uses a PWM pin on the microcontroller to determine the colour, intensity and LED to be lit. Make sure to use an external power supply to power the LEDs. An LED ribbon can be very power hungry, especially if it is long and several ribbons are powered in series. For a WS2812B LED ribbon, 50mA per LED or 2.5A for 50 LEDs is required. Check carefully the number and type of LEDs you wish to illuminate in order to choose the best voltage source.


Several libraries can be used depending on the brand of the LED ribbon such as Adafruit_NeoPixel or PololuLedStrip. In this tutorial we use the FastLED.h library. To initialize the library, you need to specify the type and number of LEDs used as well as the order of colours (Red, Green, Blue) which can be different according to the ribbon models.
Once the object has been initialised, it is possible to access each LED via the LED array. It is possible to define the colour and luminous intensity of the LED i using the led function [i].setRGB() and then validating with the function FastLED.show().

#include <FastLED.h>//https://github.com/FastLED/FastLED

#define NUM_STRIPS 1
#define NUM_LEDS 60
#define BRIGHTNESS 10
#define LED_TYPE WS2812B
#define COOLING 55
#define SPARKING 120

const int stripPin  = 3;

bool gReverseDirection  = false;


void setup() {
  //Init Serial USB
  Serial.println(F("Initialize System"));
  //Init led strips
  FastLED.addLeds<LED_TYPE, stripPin, COLOR_ORDER>(leds, NUM_LEDS);
  FastLED.setBrightness(  BRIGHTNESS );

void loop() {

void ledScenario(void ) { /* function ledScenario */
  ////LEDS Strip scenario
  for (int i = 0; i < NUM_LEDS; i++) {
    //leds[i] = CRGB::Goldenrod;
    leds[i].setRGB(255, 0, 255);
    leds[i + 3].setRGB(255, 0, 255);
    leds[i] = CRGB::Black;


  • Create a bright atmosphere in your flat
  • Creating a lamp that changes light according to the music


Find other examples and tutorials in our Automatic code generator
Code Architect

How useful was this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.

As you found this post useful...

Follow us on social media!

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?