Created
January 28, 2020 18:41
-
-
Save remisarrailh/d8c6f2c4e0dd1284d5f278af7ab0adfc to your computer and use it in GitHub Desktop.
Neo Matrix test for M5 Atom (using FastLed)
This file contains hidden or 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
// Adafruit_NeoMatrix example for single NeoPixel Shield. | |
// Scrolls 'Howdy' across the matrix in a portrait (vertical) orientation. | |
#include <Adafruit_GFX.h> | |
#include <FastLED.h> | |
#include <FastLED_NeoMatrix.h> | |
#include <Fonts/TomThumb.h> | |
#define PIN 27 | |
#define mw 5 | |
#define mh 5 | |
#define NUMMATRIX (mw*mh) | |
CRGB matrixleds[NUMMATRIX]; | |
FastLED_NeoMatrix *matrix = new FastLED_NeoMatrix(matrixleds, mw, mh, | |
NEO_MATRIX_TOP + NEO_MATRIX_RIGHT + | |
NEO_MATRIX_COLUMNS + NEO_MATRIX_PROGRESSIVE ); | |
const uint16_t colors[] = { | |
matrix->Color(255, 0, 0), matrix->Color(0, 255, 0), matrix->Color(0, 0, 255) }; | |
void setup() { | |
FastLED.addLeds<NEOPIXEL,PIN>(matrixleds, NUMMATRIX); | |
matrix->begin(); | |
matrix->setTextWrap(false); | |
matrix->setFont(&TomThumb); | |
matrix->setBrightness(40); | |
matrix->setTextColor(colors[0]); | |
} | |
int x = mh; | |
int pass = 0; | |
void loop() { | |
matrix->fillScreen(0); | |
matrix->setCursor(x, mh); | |
matrix->print(F("Hello World")); | |
if(--x < -60) { | |
x = matrix->width(); | |
if(++pass >= 3) pass = 0; | |
matrix->setTextColor(colors[pass]); | |
} | |
matrix->show(); | |
delay(100); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment