Introduction: Eye Mask Sleeping Music
This is a project let you sleep better at night, rely on the slow version Christmas song on the eye mask.
Step 1: Prepare Materials
Materials
1. Arduino Leonardo
2. Electronic Material Horn
3. Eye mask (the one you prefer the most)
Step 2: Build Up
Build up your Arduino Leonardo Board
Put the Electronic Material Horn directly on the place I drew
(Make sure it won't move around)
Step 3: Time for Program
This is the time for program, open your "Arduino" on your laptop and directly copy the program down here.
int buzzerPin = 13;
int tempo = 200; char notes[] = "eeeeeeegcde fffffeeeeddedg"; int duration[] = {1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2};
void playTheShit(char note, int duration) { char notesName[] = { 'c', 'd', 'e', 'f', 'g' }; int tones[] = { 261, 293, 329, 349, 392 };
for (int i = 0; i < sizeof(tones); i++) { // Bind the note took from the char array to the array notesName if (note == notesName[i]) { // Bind the notesName to tones tone(buzzerPin, tones[i], duration); } } }
void setup() { pinMode(buzzerPin, OUTPUT); }
void loop() { // Scan each char from "notes" for (int i = 0; i <= sizeof(notes)-1; i++) { if (notes[i] == ' ') { // If find a space it rests delay(duration[i] * tempo); } else { playTheShit(notes[i], duration[i] * tempo); }
// Pauses between notes delay((tempo*2)*duration[i]); } }
Step 4: Plug
Plug the battery to your Arduino board
Make sure the program works
If it doesn't, just comment
Step 5: Make Your Eye Mask
Stick the horn on your eye mask
Put it on, and sleep
Write on your name before others steal.