Created
December 27, 2020 23:46
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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