Speaker Beep Bug Hunt! Test your Troubleshooting.

Here’s how Bug Hunts work:

We’ve taken the example code from the related project code (in this case, Speaker Beep) and inserted errors into it. These errors might be spelling problems, syntax, or we might have changed up how the program works altogether!

The goal of the Bug Hunt is to find and fix the errors so that when you upload the code, it runs just like the example code did on the project page.

There are multiple ways to approach a bug hunt:

1) You can try to scan the code first, looking for anything that is out of place. We recommend you do this first to build up your ‘bug hunting instincts’.

2) You can press ‘Upload the Code’ with your Code Speaker plugged in. The code won’t work, but it will show you the errors that the computer found in a new window just below the code editor window. These clues are sometimes vague or confusing, but they may help you find out where the problem is.

3) Get out the purple cards from your kit. Find each purple card that references a code concept you see in the buggy program. Compare what the purple card says about each code concept to what you see on the screen. Are they the same? What’s different? That may be the bug!

Get stuck? Click on ‘Need a Hint?’ below. It will provide a clue about what’s wrong in this program. Really, really stuck? Pull up the example project code side-by-side with the buggy code and compare them until you find out what’s wrong.

//Buggy: Beep a tone on the piano once a second void setup(){ pinMode[10,OUTPUT); //Set the speaker as an OUTPUT } void loop(){ tone(10,400); //Play a tone of 400 hertz on pin 10 delay(1000); //delay the program for 1 second noTone(10); //Stop the tone on pin 10 delay(1000]; //wait 1 second before the loop starts on line 6 again }

Need a hint? Click here.