LESSON: PLAY 3 TONES TO A SPEAKER
Step 2 - Checkout the Code // UPLOAD

/* * Send 3 rising tones to a speaker */ void setup(){ pinMode(A5,OUTPUT); //Set up your speaker on pin A5 & the other pin in GND //Send a tone of 250 hertz, then 450, then 850, then stop tone(A5,250); //Send a tone of 250 hertz delay(1000); //Wait one second tone(A5,450); //Send a tone of 450 hertz delay(1000); //Wait one second tone(A5,850); //Send a tone of 850 hertz delay(1000); //Wait one second noTone(A5); //Stop the tone delay(1000); //Wait one second } void loop(){ } // (c) 2017 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 

Writing three tones to a speaker is easy when there are built-in functions to help. The tone() function works by entering the pin that you want to send the tone to, then the frequency of the tone, measured in hertz.