Interactive Art Project Code, Pictures and Parts – Erica Ruleau and Dustin Drenk

Code:

#define NOTE_C 262
#define NOTE_CC 277
#define NOTE_D 294
#define NOTE_DD 311
#define NOTE_E 330
#define NOTE_F 349
#define NOTE_FF 370
#define NOTE_G 392
#define NOTE_GG 415
#define NOTE_A 440
#define NOTE_AA 466
#define NOTE_B 494

#define ACTIVATED LOW

const int PIEZO = 13;

const int BUTTON_C = 12;
const int BUTTON_CC = 11;
const int BUTTON_D = 10;
const int BUTTON_DD = 9;
const int BUTTON_E = 8;
const int BUTTON_F = 7;
const int BUTTON_FF = 6;
const int BUTTON_G = 5;
const int BUTTON_GG = 4;
const int BUTTON_A = 3;
const int BUTTON_AA = 2;
const int BUTTON_B = 1;

void setup()
{
//pinMode(LED, OUTPUT);
pinMode(BUTTON_C, INPUT);
digitalWrite(BUTTON_C,HIGH);
pinMode(BUTTON_CC, INPUT);
digitalWrite(BUTTON_CC,HIGH);
pinMode(BUTTON_D, INPUT);
digitalWrite(BUTTON_D,HIGH);
pinMode(BUTTON_DD, INPUT);
digitalWrite(BUTTON_DD,HIGH);
pinMode(BUTTON_E, INPUT);
digitalWrite(BUTTON_E,HIGH);
pinMode(BUTTON_F, INPUT);
digitalWrite(BUTTON_F,HIGH);
pinMode(BUTTON_FF, INPUT);
digitalWrite(BUTTON_FF,HIGH);
pinMode(BUTTON_G, INPUT);
digitalWrite(BUTTON_G,HIGH);
pinMode(BUTTON_GG, INPUT);
digitalWrite(BUTTON_GG,HIGH);
pinMode(BUTTON_A, INPUT);
digitalWrite(BUTTON_A,HIGH);
pinMode(BUTTON_AA, INPUT);
digitalWrite(BUTTON_AA,HIGH);
pinMode(BUTTON_B, INPUT);
digitalWrite(BUTTON_B,HIGH);

//digitalWrite(LED,LOW);
}

void loop()
{
while(digitalRead(BUTTON_C) == ACTIVATED)
{
tone(PIEZO,NOTE_C);
//digitalWrite(LED,HIGH);
}
while(digitalRead(BUTTON_CC) == ACTIVATED)
{
tone(PIEZO,NOTE_CC);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_D) == ACTIVATED)
{
tone(PIEZO,NOTE_D);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_DD) == ACTIVATED)
{
tone(PIEZO,NOTE_DD);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_E) == ACTIVATED)
{
tone(PIEZO,NOTE_E);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_F) == ACTIVATED)
{
tone(PIEZO,NOTE_F);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_FF) == ACTIVATED)
{
tone(PIEZO,NOTE_FF);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_G) == ACTIVATED)
{
tone(PIEZO,NOTE_G);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_GG) == ACTIVATED)
{
tone(PIEZO,NOTE_GG);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_A) == ACTIVATED)
{
tone(PIEZO,NOTE_A);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_AA) == ACTIVATED)
{
tone(PIEZO,NOTE_AA);
//digitalWrite(LED,HIGH);
}

while(digitalRead(BUTTON_B) == ACTIVATED)
{
tone(PIEZO,NOTE_B);
//digitalWrite(LED,HIGH);
}

noTone(PIEZO);
//digitalWrite(LED,LOW);

}

Parts List:

Particle Board – Arduino – Copper Wire – Piezo Speaker – Speaker Wire – Momentary Button Switches – Hot Glue – 9V Battery – 9V Battery Power Converter for Arduino – Solder