Skip to content

Commit 0841e4a

Browse files
authored
Merge pull request #32 from karlsoderby/karlsoderby/add-matrix-example
Add LED Matrix Default Example
2 parents 761681e + 261499f commit 0841e4a

File tree

2 files changed

+398
-0
lines changed

2 files changed

+398
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
Heart Animation Sketch
3+
4+
This is the default sketch that comes
5+
shipped with every UNO R4 WiFi board.
6+
7+
After the animation (a heart) is complete,
8+
the built-in LED blinks infinitely.
9+
10+
No additional circuit required.
11+
12+
created 26 Jun 2023
13+
by Martino Facchin
14+
*/
15+
16+
17+
// include the LED Matrix library from the Uno R4 core:
18+
#include "Arduino_LED_Matrix.h"
19+
// make an instance of the library:
20+
ArduinoLEDMatrix matrix;
21+
//include the "animation.h" header file that stores the frames for the animation
22+
#include "animation.h"
23+
24+
void setup() {
25+
Serial.begin(115200);
26+
//load frames from the animation.h file
27+
matrix.loadSequence(frames);
28+
// start the matrix
29+
matrix.begin();
30+
31+
// turn on autoscroll to avoid calling next() to show the next frame; the paramenter is in milliseconds
32+
// matrix.autoscroll(300);
33+
34+
//play the animation on the matrix
35+
matrix.play(true);
36+
37+
//define LED_BUILTIN as an output
38+
pinMode(LED_BUILTIN, OUTPUT);
39+
}
40+
41+
void loop() {
42+
//blinks the built-in LED every second
43+
digitalWrite(LED_BUILTIN, HIGH);
44+
delay(1000);
45+
digitalWrite(LED_BUILTIN, LOW);
46+
delay(1000);
47+
}
Lines changed: 351 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,351 @@
1+
#include <stdint.h>
2+
const unsigned long frames[][4] = {
3+
{
4+
0xe0000000,
5+
0x0,
6+
0x0,
7+
66
8+
},
9+
{
10+
0x400e0000,
11+
0x0,
12+
0x0,
13+
66
14+
},
15+
{
16+
0x400e0,
17+
0x0,
18+
0x0,
19+
66
20+
},
21+
{
22+
0x40,
23+
0xe000000,
24+
0x0,
25+
66
26+
},
27+
{
28+
0x3000000,
29+
0x400e000,
30+
0x0,
31+
66
32+
},
33+
{
34+
0x3003000,
35+
0x400e,
36+
0x0,
37+
66
38+
},
39+
{
40+
0x3003,
41+
0x4,
42+
0xe00000,
43+
66
44+
},
45+
{
46+
0x3,
47+
0x300000,
48+
0x400e00,
49+
66
50+
},
51+
{
52+
0x0,
53+
0x300300,
54+
0x400e00,
55+
66
56+
},
57+
{
58+
0x1c000000,
59+
0x300,
60+
0x30400e00,
61+
66
62+
},
63+
{
64+
0x401c000,
65+
0x0,
66+
0x30430e00,
67+
66
68+
},
69+
{
70+
0x401c,
71+
0x0,
72+
0x430e30,
73+
66
74+
},
75+
{
76+
0x4,
77+
0x1c00000,
78+
0x430e30,
79+
66
80+
},
81+
{
82+
0x0,
83+
0x401c00,
84+
0x430e30,
85+
66
86+
},
87+
{
88+
0x800000,
89+
0x401,
90+
0xc0430e30,
91+
66
92+
},
93+
{
94+
0x800800,
95+
0x0,
96+
0x405f0e30,
97+
66
98+
},
99+
{
100+
0x800800,
101+
0x80000000,
102+
0x470ff0,
103+
66
104+
},
105+
{
106+
0x800800,
107+
0x80080000,
108+
0x470ff0,
109+
66
110+
},
111+
{
112+
0x800,
113+
0x80080080,
114+
0x470ff0,
115+
66
116+
},
117+
{
118+
0x38000000,
119+
0x80080080,
120+
0x8470ff0,
121+
66
122+
},
123+
{
124+
0x10038000,
125+
0x80080,
126+
0x8478ff0,
127+
66
128+
},
129+
{
130+
0x10038,
131+
0x80,
132+
0x8478ff8,
133+
66
134+
},
135+
{
136+
0x700010,
137+
0x3800080,
138+
0x8478ff8,
139+
66
140+
},
141+
{
142+
0x400700,
143+
0x1003880,
144+
0x8478ff8,
145+
66
146+
},
147+
{
148+
0x400,
149+
0x70001083,
150+
0x88478ff8,
151+
66
152+
},
153+
{
154+
0xf000000,
155+
0x40070081,
156+
0x87f8ff8,
157+
66
158+
},
159+
{
160+
0xf000,
161+
0x400f1,
162+
0x87f8ff8,
163+
66
164+
},
165+
{
166+
0x8000000f,
167+
0xc1,
168+
0xf7f8ff8,
169+
66
170+
},
171+
{
172+
0xc0080000,
173+
0xf00081,
174+
0xc7ffff8,
175+
66
176+
},
177+
{
178+
0x400c0080,
179+
0xf81,
180+
0x87fcfff,
181+
66
182+
},
183+
{
184+
0x3400c0,
185+
0x8000081,
186+
0xf87fcfff,
187+
66
188+
},
189+
{
190+
0x20200340,
191+
0xc008081,
192+
0xf87fcfff,
193+
66
194+
},
195+
{
196+
0x38220200,
197+
0x3400c089,
198+
0xf87fcfff,
199+
66
200+
},
201+
{
202+
0x38220,
203+
0x2003408d,
204+
0xf8ffcfff,
205+
66
206+
},
207+
{
208+
0x86100038,
209+
0x220240bd,
210+
0xf8ffcfff,
211+
66
212+
},
213+
{
214+
0xec186100,
215+
0x38260ad,
216+
0xfbffcfff,
217+
66
218+
},
219+
{
220+
0x3ec186,
221+
0x100078af,
222+
0xfaffffff,
223+
66
224+
},
225+
{
226+
0x114003ec,
227+
0x186178af,
228+
0xfaffffff,
229+
66
230+
},
231+
{
232+
0x3b411400,
233+
0x3ec1febf,
234+
0xfaffffff,
235+
66
236+
},
237+
{
238+
0x143b411,
239+
0x4ec3febf,
240+
0xfbffffff,
241+
66
242+
},
243+
{
244+
0xc040143b,
245+
0x4fd7febf,
246+
0xfbffffff,
247+
66
248+
},
249+
{
250+
0xc60c0439,
251+
0x4ff7ffff,
252+
0xfbffffff,
253+
66
254+
},
255+
{
256+
0x33c60f9,
257+
0x4ff7ffff,
258+
0xffffffff,
259+
66
260+
},
261+
{
262+
0x3cbc33ff,
263+
0x4ff7ffff,
264+
0xffffffff,
265+
66
266+
},
267+
{
268+
0x8ffbff,
269+
0x7ff7ffff,
270+
0xffffffff,
271+
66
272+
},
273+
{
274+
0xf0cffbff,
275+
0xfff7ffff,
276+
0xffffffff,
277+
66
278+
},
279+
{
280+
0xfe1fffff,
281+
0xffffffff,
282+
0xffffffff,
283+
66
284+
},
285+
{
286+
0xffffffff,
287+
0xffffffff,
288+
0xffffffff,
289+
66
290+
},
291+
{
292+
0x7fffffff,
293+
0xffffffff,
294+
0xfffff7ff,
295+
66
296+
},
297+
{
298+
0x3fe7ffff,
299+
0xffffffff,
300+
0xff7ff3fe,
301+
66
302+
},
303+
{
304+
0x1fc3fe7f,
305+
0xfffffff7,
306+
0xff3fe1fc,
307+
66
308+
},
309+
{
310+
0xf81fc3f,
311+
0xe7ff7ff3,
312+
0xfe1fc0f8,
313+
66
314+
},
315+
{
316+
0x500f81f,
317+
0xc3fe3fe1,
318+
0xfc0f8070,
319+
66
320+
},
321+
{
322+
0x500f,
323+
0x81fc1fc0,
324+
0xf8070020,
325+
66
326+
},
327+
{
328+
0x5,
329+
0xf80f80,
330+
0x70020000,
331+
66
332+
},
333+
{
334+
0x5,
335+
0xa80880,
336+
0x50020000,
337+
600
338+
},
339+
{
340+
0xd812,
341+
0x41040880,
342+
0x50020000,
343+
200
344+
},
345+
{
346+
0x5,
347+
0xa80880,
348+
0x50020000,
349+
0xFFFFFFFF
350+
}
351+
};

0 commit comments

Comments
 (0)