Bug Hunt! Test your Troubleshooting.

You may have already run into some errors in modifying or writing your own code. Don't worry, studies have shown that almost half of all code 'compiles' result in an error! 

The code below has some errors sprinkled in it. Before you run the code, read through it and look for the errors, called bugs. Can you find them? Try to fix each one and then see if the code runs. 

/* * Play a tune on the horn of Code Car */ void setup() { pinMode(2,OUTPUT); //set the speaker to OUTPUT } void loop() { tone(2,250); //send a tone of 250 hertz to pin 2 delay(1000); //wait 1 second before running the next line of code tone(2,500); //send a tone of 500 hertz to pin 2 delay(1000); tone(2,1000) //send a tone of 1000 hertz to pin 2 delay(1000); noTone(2); //stop all tones on pin 2 delay(1000); //wait 1 second before the code starts the loop again } //this brace ends the void loop // (c) 2022 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.