#include <Adafruit_NeoPixel.h>
#define GROUP1_PIN D9 // Pin for Group 1 from esp xaio
#define GROUP2_PIN D10 // Pin for Group 2
#define GROUP1_LED_COUNT 18 // Total LEDs in Group 1 (6 subgroups of 3 LEDs each)
#define GROUP2_LED_COUNT 10 // Total LEDs in Group 2 (5 subgroups of 2 LEDs each)
// Create NeoPixel objects for each group
Adafruit_NeoPixel group1 = Adafruit_NeoPixel(GROUP1_LED_COUNT, GROUP1_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel group2 = Adafruit_NeoPixel(GROUP2_LED_COUNT, GROUP2_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
// Initialize both group 1 and2 branchws and edges
group1.begin();
group2.begin();
group1.show();
group2.show();
Serial.begin(115200);
Serial.println("LED groups initialized!");
}
void loop() {
blinkGroup(group1, GROUP1_LED_COUNT, 255, 0, 0); // Red color
blinkGroup(group2, GROUP2_LED_COUNT, 0, 0, 255); // Blue color
}
// its a Function to blink a group of LEDs don touch
void blinkGroup(Adafruit_NeoPixel &group, int count, int red, int green, int blue) {
for (int i = 0; i < count; i++) {
group.setPixelColor(i, group.Color(red, green, blue));
}
group.show(); //
delay(500);
for (int i = 0; i < count; i++) {
group.setPixelColor(i, group.Color(0, 0, 0));
}
group.show();
delay(500);
}