Skip to content

Add a clear() method to the LED matrix library #280

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ void loop() {
matrix.loadFrame(LEDMATRIX_HEART_BIG);
delay(500);

// Turn off the display
matrix.clear();
delay(1000);

// Print the current value of millis() to the serial monitor
Serial.println(millis());
}
10 changes: 10 additions & 0 deletions libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,16 @@ class ArduinoLEDMatrix
_callBack = callBack;
}

void clear() {
const uint32_t fullOff[] = {
0x00000000,
0x00000000,
0x00000000
};
loadFrame(fullOff);
}


#ifdef MATRIX_WITH_ARDUINOGRAPHICS
virtual void set(int x, int y, uint8_t r, uint8_t g, uint8_t b) {
if (y >= canvasHeight || x >= canvasWidth || y < 0 || x < 0) {
Expand Down
Loading