Skip to content

Instantly share code, notes, and snippets.

@pandax381
Created September 16, 2020 11:00
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 pandax381/c6b67d7f4de669aa4567c7395b89dc5d to your computer and use it in GitHub Desktop.
Save pandax381/c6b67d7f4de669aa4567c7395b89dc5d to your computer and use it in GitHub Desktop.
FastLED_NeoMatrix Test
#include <M5StickC.h>
#include <Adafruit_GFX.h>
#include <FastLED.h>
#include <FastLED_NeoMatrix.h>
#define PIN 26
#define mw 18
#define mh 7
#define NUMMATRIX (mw*mh)
CRGB matrixleds[NUMMATRIX];
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(matrixleds, mw, mh, NEO_MATRIX_TOP + NEO_MATRIX_LEFT + NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE );
const uint16_t colors[] = { matrix->Color(255, 0, 0), matrix->Color(0, 255, 0), matrix->Color(0, 0, 255) };
void setup() {
M5.begin();
delay(1000); // 1 second delay for recovery
Serial.begin(115200);
FastLED.addLeds<NEOPIXEL,PIN>(matrixleds, NUMMATRIX);
matrix->begin();
matrix->setTextWrap(false);
matrix->setBrightness(10);
matrix->setTextColor(colors[0]);
}
int x = matrix->width();
int pass = 0;
void loop() {
matrix->fillScreen(0);
matrix->setCursor(x, 0);
matrix->print(F("Hello, FastLED NeoMatrix"));
if(--x < -144) {
x = matrix->width();
if(++pass >= 3) pass = 0;
matrix->setTextColor(colors[pass]);
}
matrix->show();
delay(50);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment