// https://forum.arduino.cc/t/need-help-with-ws2812b-matrix/1300473/
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include <Adafruit_NeoPixel.h>
#ifndef PSTR
#define PSTR // Make Arduino Due happy
#endif
// #define COLS 64 // rngr2000
#define COLS 32 // xfpd
#define ROWS 8
#define PIN 6
// #define BRIGHT 50 // define brightness 0 to 255
#define BRIGHT 255 // xfpd
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(
COLS, ROWS, PIN,
NEO_MATRIX_TOP +
NEO_MATRIX_LEFT +
// NEO_MATRIX_COLUMNS + // rngr2000
NEO_MATRIX_ROWS + // xfpd
// NEO_MATRIX_ZIGZAG, // rngr2000
NEO_MATRIX_PROGRESSIVE, // xfpd
NEO_GRB + NEO_KHZ800);
const uint16_t colors[] = {
matrix.Color(255, 0, 0), // red
matrix.Color(255, 255, 255), // wht
matrix.Color( 0, 0, 255) // blu
};
const PROGMEM char rolltide[] = {
"----@-@@" // 0 - wht/red
"-----@@-" // 1
"-----@@-" // 2
"----@-@-" // 3
"--@@@@@@" // 4
"---@--@-" // 5
"@-@---@-" // 6
"-@----@@" // 7
};
int times = 0;
int x = matrix.width();
int pass = 0;
boolean flag = false;
void setup() {
Serial.begin(115200);
matrix.begin();
matrix.setTextWrap(true);
matrix.setBrightness(BRIGHT);
matrix.setTextColor(colors[0]);
goTeamTeamTeam(); // call GoTeamTeamTeam one time
for (int i = 0; i < 3; i++)
scrollGoTeam(i); // call scrollGoTeam with color element three times
}
void loop() {
}
void goTeamTeamTeam() {
for (times = 0; times < 3; times++) {
matrix.setTextColor(colors[0]);
matrix.setCursor(5, 0);
matrix.print(F("Go"));
matrix.show(); //
delay(1000);
matrix.clear();
delay(200);
matrix.show();
delay(200);
for (int i = 0; i < 3; i++) { // Team three times
matrix.setTextColor(colors[i]);
matrix.setCursor(5, 0);
matrix.print(F("Team"));
matrix.show(); //
delay(200);
matrix.clear();
delay(200);
matrix.show();
delay(200);
}
}
}
void scrollGoTeam(int pass) {
matrix.setTextColor(colors[pass]);
for (int i = 0; i < 7 * 6 * 2; i++) { // scroll 7 letters * 6 pxels twice to clear the matrix
matrix.fillScreen(0);
matrix.setCursor(x, 0);
matrix.print(F("Go Team"));
--x; // next row/column
matrix.show();
delay(50);
}
x = matrix.width(); // start new scroll
}