mirror of
https://github.com/Makuna/NeoPixelBus.git
synced 2025-08-07 04:44:26 +02:00
It is strongly recommended to check the new allocated pointer is not null
@@ -39,12 +39,17 @@ void setup() {
|
||||
...
|
||||
}
|
||||
|
||||
void PixelCountChanged(uint16_t newCount) {
|
||||
bool PixelCountChanged(uint16_t newCount) {
|
||||
if (strip != NULL) {
|
||||
delete strip; // delete the previous dynamically created strip
|
||||
}
|
||||
strip = new NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod>(newCount, Pin); // and recreate with new count
|
||||
if (strip == NULL) {
|
||||
Serial.println("OUT OF MEMORY");
|
||||
return false;
|
||||
}
|
||||
strip->Begin();
|
||||
return true;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
|
Reference in New Issue
Block a user