Skip to content

Commit 184b55e

Browse files
committed
manually add livePreview sketch
1 parent acf3450 commit 184b55e

File tree

1 file changed

+23
-1
lines changed
  • content/hardware/02.hero/boards/uno-r4-wifi/tutorials/led-matrix

1 file changed

+23
-1
lines changed

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

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,29 @@ We have developed a tool that is used to generate frames and animations to be re
282282

283283
To use the tool you need to upload the following sketch, allowing the board to read serial inputs send by the browser.
284284

285-
<CodeBlock url="https://github.com/arduino/ArduinoCore-renesas/blob/main/libraries/Arduino_LED_Matrix/examples/LivePreview/LivePreview.ino" className="arduino"/>
285+
```arduino
286+
#include "Arduino_LED_Matrix.h"
287+
288+
ArduinoLEDMatrix matrix;
289+
290+
void setup() {
291+
Serial.begin(115200);
292+
matrix.begin();
293+
}
294+
295+
uint32_t frame[] = {
296+
0, 0, 0, 0xFFFF
297+
};
298+
299+
void loop() {
300+
if(Serial.available() >= 12){
301+
frame[0] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
302+
frame[1] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
303+
frame[2] = Serial.read() | Serial.read() << 8 | Serial.read() << 16 | Serial.read() << 24;
304+
matrix.loadFrame(frame);
305+
}
306+
}
307+
```
286308

287309
[Click here](https://ledmatrix-editor.arduino.cc) to go to the LED Matrix tool.
288310

0 commit comments

Comments
 (0)