#include <Adafruit_NeoPixel.h>
#define PIN 6 // Pin where the NeoPixel ring is connected
#define BUZZER_PIN 4 // Pin where the Buzzer is connected
#define NUMPIXELS 11 // Number of LEDs in the ring
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
pixels.begin(); // Initialize the NeoPixel library
pinMode(BUZZER_PIN, OUTPUT);
}
void loop() {
blinkRing(); // Call the blinkRing function
delay(250); // Delay for 250ms
}
void blinkRing() {
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 0)); // Set pixel color to red
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 255, 0)); // Set pixel color to green
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 0, 255)); // Set pixel color to blue
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 0, 255)); // Set pixel color to purple
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(0, 255, 255)); // Set pixel color to cyan
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(254, 153, 0)); // Set pixel color to orange
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(204, 108, 231)); // Set pixel color to purple
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 222, 89)); // Set pixel color to purple
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
for (int i = 0; i < NUMPIXELS; i++) {
pixels.setPixelColor(i, pixels.Color(255, 255, 255)); // Set pixel color to purple
}
pixels.show(); // Update the ring to display the colors
tone(BUZZER_PIN, 1000, 500); // Make a sound with the buzzer (frequency: 1000Hz, duration: 500ms)
delay(250); // Delay for 250ms
}