Skip to content

Instantly share code, notes, and snippets.

@Abathargh
Created December 27, 2020 23:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Abathargh/7486619b30131e7831ec8de568a29806 to your computer and use it in GitHub Desktop.
Save Abathargh/7486619b30131e7831ec8de568a29806 to your computer and use it in GitHub Desktop.
Quick reference example of actuating a WS2812B 8x8 Led matrix with FastLed.h
#include <FastLED.h>
#define NUM_LEDS 64
#define DATA_PIN 0
CRGB leds[NUM_LEDS];
int set = 0;
void setup() {
FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(20);
FastLED.showColor(CRGB::Black);
}
void loop() {
switch (set) {
case 0:
FastLED.showColor(CRGB::Black);
break;
case 1:
FastLED.showColor(CRGB::Blue);
break;
case 2:
FastLED.showColor(CRGB::Aquamarine);
break;
case 3:
FastLED.showColor(CRGB::Green);
break;
case 4:
FastLED.showColor(CRGB::Orange);
break;
case 5:
FastLED.showColor(CRGB::Yellow);
break;
case 6:
FastLED.showColor(CRGB::Red);
set = 0;
break;
default:
FastLED.showColor(CRGB::Black);
set = 0;
break;
}
set++;
delay(5000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment