Project Members: 
Emelie Cheng
Kimberly_Lau
Srinivasan Ramaswamy
Description
A musical instrument that plays musical tracks and flashes LEDs depending upon which switch is pressed. Uses processing to play music.
Materials
- Plastic waterbottle
- coffee stirrers
- 5 Leds
- 5 10k resistors
- 5+ switches
- Balsa Wood
- Paper towel inner roll
- Blue tape
- Arduino & breadboard
Arduino Code
// define input pins for each switch
int switchOne = 2; //Pins 0 and 1 are used for Transmit/Receive and don't work for input
int switchTwo = 4; //pin3 appears to be BAD
int switchThree = 5;
int switchFour= 7; //so does pin6
int switchFive = 8;
// define variables to store the value coming from the switches
int valOne = LOW;
int valTwo = LOW;
int valThree = LOW;
int valFour = LOW;
int valFive = LOW;
void setup() {
// set the input mode for each pin
pinMode(switchOne, INPUT);
pinMode(switchTwo, INPUT);
pinMode(switchThree, INPUT);
pinMode(switchFour, INPUT);
pinMode(switchFive, INPUT);
Serial.begin(9600);
}
void loop() {
valOne = digitalRead(switchOne); // read the value from the sensor (High or Low)
if(valOne==HIGH) {
Serial.print(1);
}
valTwo = digitalRead(switchTwo); // read the value from switch
if(valTwo==HIGH) {
Serial.print(2);
}
valThree = digitalRead(switchThree); // read the value from switch
if(valThree==HIGH) {
Serial.print(3);
}
valFour = digitalRead(switchFour); // read the value from switch
if(valFour==HIGH) {
Serial.print(4);
}
valFive = digitalRead(switchFive); // read the value from switch
if(valFive==HIGH) {
Serial.print(5);
}
delay(100);
}
Picture
