#include <Adafruit_NeoPixel.h>
class ledPanel {
const byte gpio ; // hold the pinNumber of each GPIO Used
const size_t numLeds ; // Number of leds per panel or strip
uint32_t defColor ; // defaulted color when loading
bool panelEnabled ; // tell if panel is enabled or not
Adafruit_NeoPixel strip ;
public:
ledPanel(const byte pin, const size_t count, uint32_t col, bool en = true)
: gpio(pin), numLeds(count), defColor(col), panelEnabled(en), strip(Adafruit_NeoPixel(numLeds, gpio, NEO_GRB + NEO_KHZ800))
{}
void begin() {
strip.begin();
strip.clear();
if (panelEnabled) {
for (size_t i = 0; i < numLeds; i++) {
strip.setPixelColor(i, defColor);
strip.show();
delay(50);
}
}
}
};
ledPanel panels[] = {
{2, 5, 0xFF0000}, // pin 2, 5 pixels, red
{4, 10, 0x00FF00}, // pin 4, 10 pixels, green
{5, 15, 0x0000FF}, // pin 5, 15 pixels, blue
};
void setup() {
Serial.begin(115200);
for (auto& p : panels) p.begin();
}
void loop() {}