Skip to content

Commit 8b1c030

Browse files
authored
Merge pull request arduino#280 from arduino/ledmatrix-clear
Add a clear() method to the LED matrix library
2 parents 141018d + 7caf4d1 commit 8b1c030

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

libraries/Arduino_LED_Matrix/examples/DisplaySingleFrame/DisplaySingleFrame.ino

+4
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ void loop() {
3434
matrix.loadFrame(LEDMATRIX_HEART_BIG);
3535
delay(500);
3636

37+
// Turn off the display
38+
matrix.clear();
39+
delay(1000);
40+
3741
// Print the current value of millis() to the serial monitor
3842
Serial.println(millis());
3943
}

libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h

+10
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,16 @@ class ArduinoLEDMatrix
253253
_callBack = callBack;
254254
}
255255

256+
void clear() {
257+
const uint32_t fullOff[] = {
258+
0x00000000,
259+
0x00000000,
260+
0x00000000
261+
};
262+
loadFrame(fullOff);
263+
}
264+
265+
256266
#ifdef MATRIX_WITH_ARDUINOGRAPHICS
257267
virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b) {
258268
if (y >= canvasHeight || x >= canvasWidth || y < 0 || x < 0) {

0 commit comments

Comments
 (0)