// Pitches Explorations
int buzzer = 8; // introducing the integer called buzzer, and declaring its value
int duration[] = {200, 25, 200, 200, 25, 200, 200, 25, 200, 200, 700, 200, 25, 200, 200, 25, 200, 200, 25, 200, 200, 700, 400, 25, 200, 25, 200, 400, 200, 200, 700, 200, 25, 200, 200, 25, 200, 200, 25, 200, 25, 200, 200, 700, 200, 25, 200, 25, 200, 25, 200, 200, 25, 200, 200}; // introducing the integer called duration, and declaring its value
int pitch[] = {493.88, 0, 493.88, 392, 0, 392, 440, 0, 440, 493.88, 0, 493.88, 0, 493.88, 392, 0, 392, 440, 0, 440, 392, 0, 659.25, 0, 659.25, 0, 659.25, 987.77, 783.99, 440, 0, 987.77, 0, 987.77, 783.99, 0, 783.99, 880, 0, 880, 0, 880, 783.99, 0, 659.25, 0, 659.25, 0, 659.25, 0, 659.25, 1174.66, 0, 1174.66, 987.77}; //The code for the pitches of the notes
// introducing the integer called pitch, and declaring an array of values for it
void setup() // The code placed within the curly brackets of setup will run once.
{
pinMode(buzzer, OUTPUT); // The Arduino pin whose number is specified by the integer called buzzer will be expressing information, NOT capturing information.
}
void loop() // The code placed within the curly brackets of loop will run infinitely many times.
{
for (int i = 0; i < 56; i++) // The code placed within the curly brackets of the for cycle will repeat for every value of the integer i, ranging from 0 to 7, increasing by 1 for each repetition.
{
tone(buzzer, pitch[i]); // The buzzer plays the frequency specified by the [i]th item in the pitch array.
delay(duration[i]); // Wait for the amount of time specified by the value of the integer called duration.
//noTone(buzzer); // Turn off the buzzer.
//delay(duration[i]); // Wait for the amount of time specified by the value of the integer called duration.
}
delay(2000); // Wait for the amount of time that is 4 times the value of the integer called duration.
}