1+ #include " ArduinoGraphics.h"
2+ #include " Arduino_LED_Matrix.h"
3+
4+ Arduino_LED_Matrix matrix;
5+
6+ void setup () {
7+ // put your setup code here, to run once:
8+ matrix.begin ();
9+ matrix.textFont (Font_5x7);
10+ matrix.textScrollSpeed (100 );
11+ matrix.clear ();
12+ Serial.begin (115200 );
13+ }
14+
15+ uint8_t shades[104 ] = {
16+ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ,
17+ 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 , 1 ,
18+ 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 , 2 ,
19+ 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 , 3 ,
20+ 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 ,
21+ 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 , 5 ,
22+ 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 , 6 ,
23+ 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 , 7 ,
24+ };
25+
26+ const uint32_t animation[][5 ] = {
27+ { 0x38022020 ,
28+ 0x810408a0 ,
29+ 0x2200e800 ,
30+ 0x20000000 ,
31+ 66 },
32+ { 0x1c011010 ,
33+ 0x40820450 ,
34+ 0x11007400 ,
35+ 0x10000000 ,
36+ 66 },
37+ { 0x0e008808 ,
38+ 0x20410228 ,
39+ 0x08803a00 ,
40+ 0x08000000 ,
41+ 66 },
42+ { 0x07004404 ,
43+ 0x10208114 ,
44+ 0x04401d00 ,
45+ 0x04000000 ,
46+ 66 },
47+ { 0x03802202 ,
48+ 0x0810408a ,
49+ 0x02200e80 ,
50+ 0x02000000 ,
51+ 66 },
52+ { 0x01c01101 ,
53+ 0x04082045 ,
54+ 0x01100740 ,
55+ 0x01000000 ,
56+ 66 },
57+ { 0x00e00880 ,
58+ 0x82041022 ,
59+ 0x808803a0 ,
60+ 0x00000000 ,
61+ 66 },
62+ { 0x00700440 ,
63+ 0x40020011 ,
64+ 0x004401c0 ,
65+ 0x00000000 ,
66+ 66 },
67+ { 0x00380200 ,
68+ 0x20010008 ,
69+ 0x802000e0 ,
70+ 0x00000000 ,
71+ 66 },
72+ { 0x00180100 ,
73+ 0x10008004 ,
74+ 0x00100060 ,
75+ 0x00000000 ,
76+ 66 },
77+ { 0x00080080 ,
78+ 0x08004002 ,
79+ 0x00080020 ,
80+ 0x00000000 ,
81+ 66 },
82+ { 0x00000040 ,
83+ 0x04002001 ,
84+ 0x00040000 ,
85+ 0x00000000 ,
86+ 66 },
87+ { 0x00000000 ,
88+ 0x02001000 ,
89+ 0x80000000 ,
90+ 0x00000000 ,
91+ 66 },
92+ { 0x00000000 ,
93+ 0x00000000 ,
94+ 0x00000000 ,
95+ 0x00000000 ,
96+ 66 }
97+ };
98+
99+ void loop () {
100+ // Roll a string using ArduinoGraphics
101+ matrix.beginText (0 , 0 , 127 , 0 , 0 ); // X, Y, then R, G, B
102+ matrix.print (" arduino.cc/uno-q " );
103+ matrix.endText (SCROLL_LEFT);
104+ delay (1000 );
105+ // Draw shades
106+ matrix.setGrayscaleBits (3 );
107+ matrix.draw (shades);
108+ delay (1000 );
109+ matrix.clear ();
110+ // Play an animation
111+ matrix.loadSequence (animation);
112+ for (int i = 0 ; i < 10 ; i++) {
113+ matrix.playSequence ();
114+ }
115+ }
0 commit comments