#include
int Power = 11;
int PIN = 12;
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// eat timings in milliseconds for the song "Hopelessly Devoted to You" generated by chatGPT
int beats[] = {
500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500
};
int numBeats = sizeof(beats) / sizeof(beats[0]);
int beatIndex = 0;
void setup()
{
pixels.begin();
pinMode(Power, OUTPUT);
digitalWrite(Power, HIGH);
}
void loop() {
if (beatIndex < numBeats) {
pixels.clear();
pixels.setPixelColor(0, pixels.Color(15, 25, 205));
delay(beats[beatIndex] / 2);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(103, 25, 205));
delay(beats[beatIndex] / 2);
pixels.show();
beatIndex++;
} else {
delay(5000);
beatIndex = 0;
}
}
#include
int Power = 11;
int PIN = 12;
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// eat timings in milliseconds for the song "Hopelessly Devoted to You" generated by chatGPT
int beats[] = {
500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500
};
int numBeats = sizeof(beats) / sizeof(beats[0]);
int beatIndex = 0;
void setup()
{
pixels.begin();
pinMode(Power, OUTPUT);
digitalWrite(Power, HIGH);
}
void loop() {
if (beatIndex < numBeats) {
pixels.clear();
pixels.setPixelColor(0, pixels.Color(15, 25, 205));
delay(beats[beatIndex] / 2);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(103, 25, 205));
delay(beats[beatIndex] / 2);
pixels.show();
beatIndex++;
} else {
delay(5000);
beatIndex = 0;
}
}
#include
#include
// Note frequencies in Hertz
#define NOTE_B3 247
#define NOTE_C4 262
#define NOTE_D4 294
#define NOTE_E4 330
#define NOTE_F4 349
#define NOTE_G4 392
#define NOTE_A4 440
#define NOTE_B4 494
#define NOTE_C5 523
#define NOTE_D5 587
#define NOTE_E5 659
#define NOTE_F5 698
#define NOTE_G5 784
#define NOTE_A5 880
#define NOTE_B5 988
#define NOTE_C6 1046
int Power = 11;
int PIN = 12;
#define NUMPIXELS 1
Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
// Beat timings in milliseconds for the song "Hopelessly Devoted to You" from chatGPT
int beats[] = {
500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500,
500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500, 500, 1000, 500
};
int numBeats = sizeof(beats) / sizeof(beats[0]);
int beatIndex = 0;
int buzzerPin = D10; // Pin 0 is used for the buzzer
// Melody for "Hopelessly Devoted to You" using the note frequencies from chatGPT
int melody[] = {
NOTE_E5, NOTE_D5, NOTE_E5, NOTE_B4, NOTE_D5, NOTE_C5, NOTE_A4, NOTE_C5, NOTE_D5,
NOTE_E5, NOTE_B4, NOTE_D5, NOTE_C5, NOTE_A4, NOTE_G4, NOTE_E4, NOTE_G4
};
int noteDurations[] = {
4, 4, 2, 4, 4, 2, 4, 4, 4, 4, 2, 4, 4, 2, 4, 4
};
void setup() {
pixels.begin();
pinMode(Power, OUTPUT);
digitalWrite(Power, HIGH);
pinMode(buzzerPin, OUTPUT);
}
void loop() {
if (beatIndex < numBeats) {
pixels.clear();
pixels.setPixelColor(0, pixels.Color(15, 25, 205));
tone(buzzerPin, melody[beatIndex], 1000 / noteDurations[beatIndex]);
delay(beats[beatIndex] / 2);
noTone(buzzerPin);
pixels.show();
pixels.clear();
pixels.setPixelColor(0, pixels.Color(103, 25, 205));
delay(beats[beatIndex] / 2);
pixels.show();
beatIndex++;
} else {
delay(5000);
beatIndex = 0;
}
}