Skip to content

Instantly share code, notes, and snippets.

@Park-Developer
Created December 24, 2021 22:12
Show Gist options
  • Save Park-Developer/f37342aebb1d84bc0bb39c1905515c45 to your computer and use it in GitHub Desktop.
Save Park-Developer/f37342aebb1d84bc0bb39c1905515c45 to your computer and use it in GitHub Desktop.
Arduino WS2812B LED Examples
#include <FastLED.h>
#define LED_PIN 7
#define NUM_LEDS 20
CRGB leds[NUM_LEDS];
void setup() {
FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
}
void loop() {
leds[0] = CRGB(255, 0, 0);
FastLED.show();
delay(500);
leds[1] = CRGB(0, 255, 0);
FastLED.show();
delay(500);
leds[2] = CRGB(0, 0, 255);
FastLED.show();
delay(500);
leds[5] = CRGB(150, 0, 255);
FastLED.show();
delay(500);
leds[9] = CRGB(255, 200, 20);
FastLED.show();
delay(500);
leds[14] = CRGB(85, 60, 180);
FastLED.show();
delay(500);
leds[19] = CRGB(50, 255, 20);
FastLED.show();
delay(500);
}
//https://github.com/FastLED/FastLED/tree/master/src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment