-
Notifications
You must be signed in to change notification settings - Fork 0
/
GoBlue.ino
42 lines (33 loc) · 929 Bytes
/
GoBlue.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include "RGB.h"
#define PIN 1
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(8, 8, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_PROGRESSIVE,
NEO_GRB + NEO_KHZ800);
void setup() {
matrix.begin();
matrix.setBrightness(50);
matrix.setTextColor(matrix.Color(white.r, white.g, white.b) );
matrix.setTextWrap(false);
}
void loop() {
matrix.show();
scrollText("GO BLUE!");
}
void scrollText(String textToDisplay) {
int x = matrix.width();
int pixelsInText = textToDisplay.length() * 7;
matrix.setCursor(x, 0);
matrix.print(textToDisplay);
matrix.show();
while(x > (matrix.width() - pixelsInText)) {
matrix.fillScreen(matrix.Color(blue.r, blue.g, blue.b));
matrix.setCursor(--x, 0);
matrix.print(textToDisplay);
matrix.show();
delay(150);
}
}