Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4af59ff

Browse files
Merge pull request #1259 from arduino/sync/Hannes7eicher/LedMatrix-example
[MKC-1062] add live preview sketch
2 parents c07139a + 174de80 commit 4af59ff

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed
File renamed without changes.

‎content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix/led-matrix.md‎

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,38 @@ delay(1000);
280280
## Animation Generation
281281
We have developed a tool that is used to generate frames and animations to be rendered on the LED Matrix in your browser. This tool is part of [Arduino labs](https://labs.arduino.cc), and is therefore considered experimental software.
282282

283-
[Click here](https://ledmatrix-editor.arduino.cc) to go to the LED Matrix tool.
283+
To use the tool you need to upload the following sketch, allowing the board to read serial inputs send by the browser.
284284

285+
You can also find the sketch in **File > Examples > LED_Matrix > LivePreview**
285286

286-
![LED Matrix Editor](./assets/led-matrix-editor.png)
287+
```arduino
288+
#include "Arduino_LED_Matrix.h"
289+
290+
ArduinoLEDMatrix matrix;
291+
292+
void setup() {
293+
Serial.begin(115200);
294+
matrix.begin();
295+
}
296+
297+
uint32_t frame[] = {
298+
0, 0, 0, 0xFFFF
299+
};
300+
301+
void loop() {
302+
if(Serial.available() >= 12){
303+
frame[0] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
304+
frame[1] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
305+
frame[2] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
306+
matrix.loadFrame(frame);
307+
}
308+
}
309+
```
310+
311+
[Click here](https://ledmatrix-editor.arduino.cc) to go to the LED Matrix tool.
312+
313+
314+
![LED Matrix Editor](./assets/led-matrix-tool.png)
287315

288316
Once you've made your animations, you can export them from the tool in the format that lets you use them like [previously discussed](#how-to-write-a-frame).
289317

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /