Add LED matrix scrolling text sketch

This commit is contained in:
christian 2026-10-24 05:48:09 +02:00
parent 44691d1946
commit ff38ca8c19
2 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,29 @@
# LED Matrix Scrolling Text
Løbetekst til den indbyggede 12×8 LED-matrix på Arduino UNO R4 WiFi.
Teksten ruller fra højre mod venstre og gentages efter en kort pause:
> Kan AI skrive programmer til Arduino? Tjek https://iot.p20.dev
Sketchen bruger de officielle biblioteker `ArduinoGraphics` og
`Arduino_LED_Matrix`. `ArduinoGraphics` kan installeres med:
```powershell
arduino-cli lib install ArduinoGraphics
```
## Kompilering
```powershell
arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi sketches/led_matrix_scrolling_text
```
## Upload
Upload først efter godkendelse:
```powershell
arduino-cli upload --port COM5 --fqbn arduino:renesas_uno:unor4wifi sketches/led_matrix_scrolling_text
```

View file

@ -0,0 +1,32 @@
#include <ArduinoGraphics.h>
#include <Arduino_LED_Matrix.h>
// Scrolling text demo for the Arduino UNO R4 WiFi 12x8 LED matrix.
constexpr unsigned long SCROLL_SPEED_MS = 75;
constexpr unsigned long REPEAT_PAUSE_MS = 1000;
const char MESSAGE[] =
"Kan AI skrive programmer til Arduino? Tjek https://iot.p20.dev";
ArduinoLEDMatrix matrix;
void setup() {
matrix.begin();
matrix.textFont(Font_5x7);
matrix.textScrollSpeed(SCROLL_SPEED_MS);
matrix.clear();
}
void loop() {
matrix.beginDraw();
matrix.stroke(0xFFFFFFFF);
matrix.beginText(12, 1, 0xFFFFFF);
matrix.print(MESSAGE);
matrix.endText(SCROLL_LEFT);
matrix.endDraw();
matrix.clear();
delay(REPEAT_PAUSE_MS);
}