Skip to content

Commit 941a7d0

Browse files
committed
led_matrix: add example with ArduinoGraphics integration
1 parent 2c86254 commit 941a7d0

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// To use ArduinoGraphics APIs, please include BEFORE Arduino_LED_Matrix
2+
#include "ArduinoGraphics.h"
3+
#include "Arduino_LED_Matrix.h"
4+
5+
ArduinoLEDMatrix matrix;
6+
7+
void setup() {
8+
Serial.begin(115200);
9+
matrix.begin();
10+
11+
matrix.beginDraw();
12+
matrix.stroke(0xFFFFFFFF);
13+
// add some static text
14+
// will only show "UNO" (not enough space on the display)
15+
const char text[] = "UNO r4";
16+
matrix.textFont(Font_4x6);
17+
matrix.beginText(0, 1, 0xFFFFFF);
18+
matrix.println(text);
19+
matrix.endText();
20+
21+
matrix.endDraw();
22+
23+
delay(2000);
24+
}
25+
26+
void loop() {
27+
28+
// Make it scroll!
29+
matrix.beginDraw();
30+
31+
matrix.stroke(0xFFFFFFFF);
32+
matrix.textScrollSpeed(50);
33+
34+
// add the text
35+
const char text[] = " Scrolling text! ";
36+
matrix.textFont(Font_5x7);
37+
matrix.beginText(0, 1, 0xFFFFFF);
38+
matrix.println(text);
39+
matrix.endText(SCROLL_LEFT);
40+
41+
matrix.endDraw();
42+
}

0 commit comments

Comments
 (0)