Rocket Morse Code Part Five Bug Hunt! Test your Troubleshooting.

Some code bugs are extremely hard to spot. Our brains sometimes skip over little differences, but the computer won’t miss them! Try to find this subtle error below.

/* Buggy: Make a beep on the speaker when you press button 12. Useful for manual Morse Code messages. */ void setup(){ pinMode(2,OUTPUT);//Speaker pinMode(12,INPUT_PULLUP); //Button } void loop(){ if(digitalRead(12)=LOW){ //if the button sends a LOW (pressed) signal tone(2,500); //play a tone of 500 hertz on pin 2 (speaker) } else{ //otherwise if no LOW signal from button noTone(2); //stop any tones that are playing on the speaker } } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.