int const SPEAKER = 2;
int const GREEN_BUTTON = 3;
int const RED_BUTTON = 4;
int const BLUE_BUTTON = 5;
int const YELLOW_BUTTON = 6;
int const BLACK_BUTTON = 7;
int const WHITE_BUTTON = 8;
int const GRAY_BUTTON = 9;
float const C = 130.81;
float const D = 146.83;
float const E = 164.81;
float const F = 174.61;
float const G = 196.00;
float const A = 220.00;
float const B = 246.94;
void setup() {
// put your setup code here, to run once:
pinMode(GREEN_BUTTON, INPUT_PULLUP);
pinMode(RED_BUTTON, INPUT_PULLUP);
pinMode(BLUE_BUTTON, INPUT_PULLUP);
pinMode(YELLOW_BUTTON, INPUT_PULLUP);
pinMode(BLACK_BUTTON, INPUT_PULLUP);
pinMode(WHITE_BUTTON, INPUT_PULLUP);
pinMode(GRAY_BUTTON, INPUT_PULLUP);
}
void loop() {
// put your main code here, to run repeatedly:
// while (digitalRead(GREEN_BUTTON) == HIGH && digitalRead(RED_BUTTON) == HIGH && digitalRead(BLUE_BUTTON) == HIGH) {
// // wait
// }
if (digitalRead(GREEN_BUTTON) == LOW) {
tone(SPEAKER, C, 100);
}
if (digitalRead(RED_BUTTON) == LOW) {
tone(SPEAKER, D, 100);
}
if (digitalRead(BLUE_BUTTON) == LOW) {
tone(SPEAKER, E, 100);
}
if (digitalRead(YELLOW_BUTTON) == LOW) {
tone(SPEAKER, F, 100);
}
if (digitalRead(BLACK_BUTTON) == LOW) {
tone(SPEAKER, G, 100);
}
if (digitalRead(WHITE_BUTTON) == LOW) {
tone(SPEAKER, A, 100);
}
if (digitalRead(GRAY_BUTTON) == LOW) {
tone(SPEAKER, B, 100);
}
delay(100);
}