フォーク元 pludi/LEDDisplay
Randomized colors
このコミットが含まれているのは:
コミット
40a20fc3be
|
@ -9,31 +9,47 @@ Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(16, 16, 2, 1, 16,
|
|||
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);
|
||||
matrix.setTextColor(matrix.Color(0, 0, 100));
|
||||
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(matrix.Color(0, 0, 128));
|
||||
matrix.setTextColor(currColor[0]);
|
||||
matrix.print("/usr/space @36C3");
|
||||
matrix.setTextColor(matrix.Color(64, 0, 0));
|
||||
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)
|
||||
if(--i < -16*6) {
|
||||
i = matrix.width();
|
||||
currColor[0] = colors[random(NUM_COLORS)];
|
||||
currColor[1] = colors[random(NUM_COLORS)];
|
||||
}
|
||||
delay(249);
|
||||
}
|
||||
|
|
読み込み中…
新しいイシューから参照