Skip to content

Commit 4bc8ffe

Browse files
authored
Merge pull request #1135 from arduino/jacobhylen/add-tetris-example
Adds the Preloaded Tetris animation sketch to the UNO R4 WiFi getting started guide
2 parents c0d3c48 + b73352d commit 4bc8ffe

File tree

1 file changed

+378
-0
lines changed

1 file changed

+378
-0
lines changed

content/hardware/02.hero/boards/uno-r4-wifi/tutorials/r4-wifi-getting-started/r4-wifi-getting-started.md

Lines changed: 378 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,384 @@ There are several examples available for the UNO R4 WiFi board, which can be acc
4646

4747
![UNO R4 WiFi examples.](assets/wifi-examples.png)
4848

49+
### Tetris Animation Sketch
50+
The UNO R4 WiFi comes preloaded with a Tetris animation. If you've overwritten that sketch and want to restore the board to play the animation again, the sketch can be found here:
51+
```arduino
52+
#include "Arduino_LED_Matrix.h"
53+
#include <stdint.h>
54+
55+
ArduinoLEDMatrix matrix;
56+
57+
const uint32_t frames[][4] = {
58+
{
59+
0xe0000000,
60+
0x0,
61+
0x0,
62+
66
63+
},
64+
{
65+
0x400e0000,
66+
0x0,
67+
0x0,
68+
66
69+
},
70+
{
71+
0x400e0,
72+
0x0,
73+
0x0,
74+
66
75+
},
76+
{
77+
0x40,
78+
0xe000000,
79+
0x0,
80+
66
81+
},
82+
{
83+
0x3000000,
84+
0x400e000,
85+
0x0,
86+
66
87+
},
88+
{
89+
0x3003000,
90+
0x400e,
91+
0x0,
92+
66
93+
},
94+
{
95+
0x3003,
96+
0x4,
97+
0xe00000,
98+
66
99+
},
100+
{
101+
0x3,
102+
0x300000,
103+
0x400e00,
104+
66
105+
},
106+
{
107+
0x0,
108+
0x300300,
109+
0x400e00,
110+
66
111+
},
112+
{
113+
0x1c000000,
114+
0x300,
115+
0x30400e00,
116+
66
117+
},
118+
{
119+
0x401c000,
120+
0x0,
121+
0x30430e00,
122+
66
123+
},
124+
{
125+
0x401c,
126+
0x0,
127+
0x430e30,
128+
66
129+
},
130+
{
131+
0x4,
132+
0x1c00000,
133+
0x430e30,
134+
66
135+
},
136+
{
137+
0x0,
138+
0x401c00,
139+
0x430e30,
140+
66
141+
},
142+
{
143+
0x800000,
144+
0x401,
145+
0xc0430e30,
146+
66
147+
},
148+
{
149+
0x800800,
150+
0x0,
151+
0x405f0e30,
152+
66
153+
},
154+
{
155+
0x800800,
156+
0x80000000,
157+
0x470ff0,
158+
66
159+
},
160+
{
161+
0x800800,
162+
0x80080000,
163+
0x470ff0,
164+
66
165+
},
166+
{
167+
0x800,
168+
0x80080080,
169+
0x470ff0,
170+
66
171+
},
172+
{
173+
0x38000000,
174+
0x80080080,
175+
0x8470ff0,
176+
66
177+
},
178+
{
179+
0x10038000,
180+
0x80080,
181+
0x8478ff0,
182+
66
183+
},
184+
{
185+
0x10038,
186+
0x80,
187+
0x8478ff8,
188+
66
189+
},
190+
{
191+
0x700010,
192+
0x3800080,
193+
0x8478ff8,
194+
66
195+
},
196+
{
197+
0x400700,
198+
0x1003880,
199+
0x8478ff8,
200+
66
201+
},
202+
{
203+
0x400,
204+
0x70001083,
205+
0x88478ff8,
206+
66
207+
},
208+
{
209+
0xf000000,
210+
0x40070081,
211+
0x87f8ff8,
212+
66
213+
},
214+
{
215+
0xf000,
216+
0x400f1,
217+
0x87f8ff8,
218+
66
219+
},
220+
{
221+
0x8000000f,
222+
0xc1,
223+
0xf7f8ff8,
224+
66
225+
},
226+
{
227+
0xc0080000,
228+
0xf00081,
229+
0xc7ffff8,
230+
66
231+
},
232+
{
233+
0x400c0080,
234+
0xf81,
235+
0x87fcfff,
236+
66
237+
},
238+
{
239+
0x3400c0,
240+
0x8000081,
241+
0xf87fcfff,
242+
66
243+
},
244+
{
245+
0x20200340,
246+
0xc008081,
247+
0xf87fcfff,
248+
66
249+
},
250+
{
251+
0x38220200,
252+
0x3400c089,
253+
0xf87fcfff,
254+
66
255+
},
256+
{
257+
0x38220,
258+
0x2003408d,
259+
0xf8ffcfff,
260+
66
261+
},
262+
{
263+
0x86100038,
264+
0x220240bd,
265+
0xf8ffcfff,
266+
66
267+
},
268+
{
269+
0xec186100,
270+
0x38260ad,
271+
0xfbffcfff,
272+
66
273+
},
274+
{
275+
0x3ec186,
276+
0x100078af,
277+
0xfaffffff,
278+
66
279+
},
280+
{
281+
0x114003ec,
282+
0x186178af,
283+
0xfaffffff,
284+
66
285+
},
286+
{
287+
0x3b411400,
288+
0x3ec1febf,
289+
0xfaffffff,
290+
66
291+
},
292+
{
293+
0x143b411,
294+
0x4ec3febf,
295+
0xfbffffff,
296+
66
297+
},
298+
{
299+
0xc040143b,
300+
0x4fd7febf,
301+
0xfbffffff,
302+
66
303+
},
304+
{
305+
0xc60c0439,
306+
0x4ff7ffff,
307+
0xfbffffff,
308+
66
309+
},
310+
{
311+
0x33c60f9,
312+
0x4ff7ffff,
313+
0xffffffff,
314+
66
315+
},
316+
{
317+
0x3cbc33ff,
318+
0x4ff7ffff,
319+
0xffffffff,
320+
66
321+
},
322+
{
323+
0x8ffbff,
324+
0x7ff7ffff,
325+
0xffffffff,
326+
66
327+
},
328+
{
329+
0xf0cffbff,
330+
0xfff7ffff,
331+
0xffffffff,
332+
66
333+
},
334+
{
335+
0xfe1fffff,
336+
0xffffffff,
337+
0xffffffff,
338+
66
339+
},
340+
{
341+
0xffffffff,
342+
0xffffffff,
343+
0xffffffff,
344+
66
345+
},
346+
{
347+
0x7fffffff,
348+
0xffffffff,
349+
0xfffff7ff,
350+
66
351+
},
352+
{
353+
0x3fe7ffff,
354+
0xffffffff,
355+
0xff7ff3fe,
356+
66
357+
},
358+
{
359+
0x1fc3fe7f,
360+
0xfffffff7,
361+
0xff3fe1fc,
362+
66
363+
},
364+
{
365+
0xf81fc3f,
366+
0xe7ff7ff3,
367+
0xfe1fc0f8,
368+
66
369+
},
370+
{
371+
0x500f81f,
372+
0xc3fe3fe1,
373+
0xfc0f8070,
374+
66
375+
},
376+
{
377+
0x500f,
378+
0x81fc1fc0,
379+
0xf8070020,
380+
66
381+
},
382+
{
383+
0x5,
384+
0xf80f80,
385+
0x70020000,
386+
66
387+
},
388+
{
389+
0x5,
390+
0xa80880,
391+
0x50020000,
392+
600
393+
},
394+
{
395+
0xd812,
396+
0x41040880,
397+
0x50020000,
398+
200
399+
},
400+
{
401+
0x5,
402+
0xa80880,
403+
0x50020000,
404+
0xFFFFFFFF
405+
}
406+
};
407+
408+
void setup() {
409+
Serial.begin(115200);
410+
// you can also load frames at runtime, without stopping the refresh
411+
matrix.loadSequence(frames);
412+
matrix.begin();
413+
// turn on autoscroll to avoid calling next() to show the next frame; the parameter is in milliseconds
414+
// matrix.autoscroll(300);
415+
matrix.play(true);
416+
pinMode(LED_BUILTIN, OUTPUT);
417+
}
418+
419+
void loop() {
420+
digitalWrite(LED_BUILTIN, HIGH);
421+
delay(1000);
422+
digitalWrite(LED_BUILTIN, LOW);
423+
delay(1000);
424+
}
425+
```
426+
49427
## Summary
50428

51429
In this tutorial, we have installed the UNO R4 WiFi board package, using the Arduino IDE.

0 commit comments

Comments
 (0)