One Key Piano Bug Hunt! Test your Troubleshooting.

This code won’t run on Code Piano - there is something stopping the computer from being able to interpret it. Can you find it?

//Buggy: Beep a tone when you press button 2 on Code Piano void setup(){ pinMode(10,OUTPUT); //Set speaker as an OUTPUT pinMode(2,INPUT_PULLUP); //Button 2 as an INPUT_PULLUP } void loop(){ if{digitalRead(2)==LOW}( //if button is sending a low signal... tone(10,500); ///...play a tone of 500 hertz on the speaker ) else{ //in all other cases (button is not sending a low signal)... noTone(10); //send a noTone command to the speaker } } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.