Tal O
Published © GPL3+

Arduino and Addressable LED

Because LED are fun - but addressable rocks. :)

BeginnerFull instructions provided2,645
Arduino and Addressable LED

Things used in this project

Hardware components

Arduino UNO & Genuino UNO
Arduino UNO & Genuino UNO
×1
WS2812 Addressable LED Strip
Digilent WS2812 Addressable LED Strip
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Schismatics

Code

Example sketch

Arduino
// include library
#include<FastLED.h>

//define number of LED and pin
#define NUM_LEDS 8
#define DATA_PIN 3

// create the ld object array
CRGB leds[NUM_LEDS];

// define 3 byte for the random color
byte  r, g, b;

void setup() {
  // init the LED object
  FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS);
  // set random seed
  randomSeed(analogRead(0));
}


void loop() {
  // loop over the NUM_LEDS
  for (int cur = 0; cur < NUM_LEDS; cur++) {
    // chose random value for the r/g/b
    r = random(0, 255);
    g = random(0, 255);
    b = random(0, 255);

    //set the value to the led
    leds[cur] = CRGB (r, g, b);

    // set the colors set into the phisical LED
    FastLED.show();

    // delay 50 millis
    FastLED.delay(200);
  }


}

Credits

Tal O

Tal O

11 projects • 18 followers
Maker @ heart

Comments

Add projectSign up / Login