forked from pludi/LEDDisplay
56 lines
1.6 KiB
C++
56 lines
1.6 KiB
C++
#include <Adafruit_GFX.h>
|
|
#include <Adafruit_NeoMatrix.h>
|
|
#include <Adafruit_NeoPixel.h>
|
|
|
|
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(16, 16, 2, 1, 16,
|
|
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
|
|
NEO_MATRIX_COLUMNS + NEO_MATRIX_ZIGZAG +
|
|
NEO_TILE_TOP + NEO_TILE_LEFT + NEO_TILE_ROWS +
|
|
NEO_TILE_PROGRESSIVE, NEO_GRB + NEO_KHZ800);
|
|
int i=0;
|
|
|
|
#define NUM_COLORS 7
|
|
const PROGMEM uint16_t colors[NUM_COLORS] = {
|
|
Adafruit_NeoMatrix::Color(127, 0, 0),
|
|
Adafruit_NeoMatrix::Color(0, 127, 0),
|
|
Adafruit_NeoMatrix::Color(0, 0, 127),
|
|
Adafruit_NeoMatrix::Color(127, 0, 127),
|
|
Adafruit_NeoMatrix::Color(127, 127, 0),
|
|
Adafruit_NeoMatrix::Color(0, 127, 127),
|
|
Adafruit_NeoMatrix::Color(127, 127, 127)
|
|
};
|
|
uint16_t currColor[2];
|
|
|
|
void setup()
|
|
{
|
|
matrix.begin();
|
|
matrix.setTextSize(1);
|
|
Serial.begin(9600);
|
|
matrix.setTextWrap(false);
|
|
Serial.println("Setup Done");
|
|
currColor[0] = colors[random(NUM_COLORS)];
|
|
currColor[1] = colors[random(NUM_COLORS)];
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
|
|
matrix.fillScreen(matrix.Color(0, 0, 0));
|
|
matrix.setCursor(i, 0);
|
|
matrix.setTextColor(currColor[0]);
|
|
matrix.print("/usr/space @36C3");
|
|
matrix.setTextColor(currColor[1]);
|
|
matrix.setCursor(i*3, 8);
|
|
matrix.print("Sticker Exchange Sticker Exchange");
|
|
portDISABLE_INTERRUPTS();
|
|
delay(1);
|
|
matrix.show();
|
|
portENABLE_INTERRUPTS();
|
|
if(--i < -16*6) {
|
|
i = matrix.width();
|
|
currColor[0] = colors[random(NUM_COLORS)];
|
|
currColor[1] = colors[random(NUM_COLORS)];
|
|
}
|
|
delay(249);
|
|
}
|