#include <Adafruit_NeoPixel.h>

#define PIN            D4  // Pin connected to the NeoPixel ring
#define NUMPIXELS      16  // Number of NeoPixels in the ring
#define BUTTON_PIN     D1  // Pin connected to the button

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pinMode(BUTTON_PIN, INPUT);
  Serial.begin(9600); // Initialize serial communication
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop() {
  int buttonState = digitalRead(BUTTON_PIN);

  if (buttonState == HIGH) {
    Serial.println("ON"); // Send "ON" message to serial monitor
    for (int i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color(255, 255, 255)); // Set all pixels to white
    }
    strip.show();
  } else {
    Serial.println("OFF"); // Send "OFF" message to serial monitor
    for (int i = 0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color(255, 0, 0)); // Set all pixels to red
    }
    strip.show();
  }
}