Speaker Triple Tone

Combine three notes to start playing a scale on Code Speaker. Then see how far you can take the code with new notes!


The code in the editor below already works. Just plug in your Code Speaker and press upload to see what it does! Tinker with it and make changes to see what each line of code controls.

// Play tones A, B, and C from a piano in a sequence void setup(){ pinMode(10,OUTPUT); //Set the speaker as an OUTPUT } void loop(){ tone(10,440); //Play a tone of 440 hertz (an A on the piano) on pin 10 delay(500); //delay the program for 1/2 second tone(10,494); //Play a B tone of 494 hertz delay(500); //delay for 1/2 second before the next note tone(10,523); //Play a C tone of 523 hertz delay(500); //wait 1/2 second before the loop starts on line 8 again } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense

Walkthrough Videos

Watch the videos for line-by-line explanation of how the example program works. Then you'll be ready to make some changes of your own!


Can you complete the challenge? Change the code in your code editor above. Upload your code to see the effect when you're finished. Complete a challenge? Check it off the list!


These are the new code concepts covered in this example program. To become a great coder, read through these concepts to learn new vocabulary.

New Concept: Building blocks

Most computer code is made up of simple concepts combined together to create more complicated things. In this project, you’re still using the tone() and delay() command, just like the last project, but you’re able to build something more complex. Using these same ‘building blocks’, you can write an entire song or create a sound effect.

As your code gets more complex, try to look for the basic building blocks within the program. When you can identify the patterns, even large programs don’t feel overwhelming.


If you're having trouble, try to run an experimental program or look at the example code to help you find the answer.

1. How long would the code ' delay(2000); ' delay a line of code from running?