Skip to content

Instantly share code, notes, and snippets.

@tomoto
Created July 10, 2020 09:52
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomoto/1c846bcedc1393f92f29ebf66de70af6 to your computer and use it in GitHub Desktop.
Save tomoto/1c846bcedc1393f92f29ebf66de70af6 to your computer and use it in GitHub Desktop.
M5Stack Atom Matrix LED example (without M5Atom library that causes flicker)
#include <FastLED.h>
const int NUM_LEDS = 25;
const int LED_PIN = 27;
static CRGB leds[NUM_LEDS];
CRGB correct(CRGB c) {
// fix RGB order :(
return CRGB(c.g, c.r, c.b);
}
void initDisplay() {
FastLED.addLeds<WS2812, LED_PIN>(leds, NUM_LEDS);
FastLED.setBrightness(20);
}
void setPixelAndShow(index i, CRGB c) {
leds[i] = correct(c);
FastLED.show();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment