Red(?) LED in stand
30 day timer → 720 hrs → 43,200 min → 2,592,000 sec → 2,592,000,000 milliseconds
Buzzer(?)
Figures in relief form (cut out with laser cutter and layered)
int K = (something)
int D = (something)
int S = (something)
int ledPin = 11
void setup() {
K ()
D ()
S ()
}
void loop() {
if (“K and D present”) {
Green LED
} else {
}
if (“K and S present”) {
Orange LED
}
if (“D and S present”) {
Purple LED
}
if (“K, S, and D present”) {
(Rainbow) NeoPixle LED
}
}
Stand
1 neopixel strip
1 buzzer
3 switches
BUZZER:
LOZ Chest music (when all 3 present):
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* This code is derived from: | |
| * http://www.arduino.cc/en/Tutorial/Melody | |
| * This plays the chest noise from the Legend of Zelda on a piezo buzzer connected to pin 9 and ground. It has been tuned to a buzzer I had on hand, but you may want to adjust the values, testing against a tuner. | |
| */ | |
| int speakerPin = 9; | |
| const int switchPin = 6; | |
| char notes[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi azbC"; // a space represents a rest | |
| int length = sizeof(notes); // the number of notes | |
| int beats[] = { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 2,3,3,16,}; | |
| int tempo = 75/4; | |
| void playTone(int tone, int duration) { | |
| for (long i = 0; i < duration * 1000L; i += tone * 2) { | |
| digitalWrite(speakerPin, HIGH); | |
| delayMicroseconds(tone); | |
| digitalWrite(speakerPin, LOW); | |
| delayMicroseconds(tone); | |
| } | |
| } | |
| void playNote(char note, int duration) { | |
| char names[] = { 'c', 'd', 'e', 'f', 'g', 'x', 'a', 'z', 'b', 'C', 'y', 'D', 'w', 'E', 'F', 'q', 'G', 'i' }; | |
| // c=C4, C = C5. These values have been tuned. | |
| int tones[] = { 1898, 1690, 1500, 1420, 1265, 1194, 1126, 1063, 1001, 947, 893, 843, 795, 749, 710, 668, 630, 594 }; | |
| // play the tone corresponding to the note name | |
| for (int i = 0; i < 18; i++) { | |
| if (names[i] == note) { | |
| playTone((tones[i])/17, duration); | |
| } | |
| } | |
| } | |
| void setup() { | |
| pinMode(speakerPin, OUTPUT); | |
| pinMode(switchPin, INPUT); | |
| digitalWrite(switchPin, HIGH); | |
| } | |
| void loop() { | |
| pinMode(speakerPin, OUTPUT); | |
| if (digitalRead(switchPin) == 1) { | |
| for (int i = 0; i < length; i++) { | |
| if (notes[i] == ' ') { | |
| delay(beats[i] * tempo); // rest | |
| } else { | |
| playNote(notes[i], beats[i] * tempo); | |
| } | |
| // pause between notes | |
| delay(tempo / 2); | |
| } | |
| } | |
| delay(100); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* This code is derived from: | |
| * http://www.arduino.cc/en/Tutorial/Melody | |
| * This plays the chest noise from the Legend of Zelda on a piezo buzzer connected to pin 9 and ground. It has been tuned to a buzzer I had on hand, but you may want to adjust the values, testing against a tuner. | |
| */ | |
| int speakerPin = 0; | |
| const int switchPin = 1; | |
| char notes[] = "gabygabyxzCDxzCDabywabywzCDEzCDEbywFCDEqywFGDEqi azbC"; // a space represents a rest | |
| int length = sizeof(notes); // the number of notes | |
| int beats[] = { 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1, 2,3,3,16,}; | |
| int tempo = 75; | |
| void playTone(int tone, int duration) { | |
| for (long i = 0; i < duration * 1000L; i += tone * 2) { | |
| digitalWrite(speakerPin, HIGH); | |
| delayMicroseconds(tone); | |
| digitalWrite(speakerPin, LOW); | |
| delayMicroseconds(tone); | |
| } | |
| } | |
| void playNote(char note, int duration) { | |
| char names[] = { 'c', 'd', 'e', 'f', 'g', 'x', 'a', 'z', 'b', 'C', 'y', 'D', 'w', 'E', 'F', 'q', 'G', 'i' }; | |
| // c=C4, C = C5. These values have been tuned. | |
| int tones[] = { 1898, 1690, 1500, 1420, 1265, 1194, 1126, 1063, 1001, 947, 893, 843, 795, 749, 710, 668, 630, 594 }; | |
| // play the tone corresponding to the note name | |
| for (int i = 0; i < 18; i++) { | |
| if (names[i] == note) { | |
| playTone(tones[i], duration); | |
| } | |
| } | |
| } | |
| void setup() { | |
| pinMode(switchPin, INPUT); | |
| digitalWrite(switchPin, HIGH); | |
| } | |
| void loop() { | |
| pinMode(speakerPin, OUTPUT); | |
| if (digitalRead(switchPin) == 1) { | |
| for (int i = 0; i < length; i++) { | |
| if (notes[i] == ' ') { | |
| delay(beats[i] * tempo); // rest | |
| } else { | |
| playNote(notes[i], beats[i] * tempo); | |
| } | |
| // pause between notes | |
| delay(tempo / 2); | |
| } | |
| } | |
| delay(100); | |
| } |
Overview of project
When 3 characters created by layering laser cut material are placed on a stand, different combinations of pressed switches result in different effects. The two types of effects are lights and sound from a neopixel strip and a buzzer. For example, if A+B are present (A and B stand for a character each) then a song AB would play and a color combination would appear on the neopixel strip.
