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. 

/* * Press button 11 for the brakes and brakelight of Code Car */ void setup(){ pinMode(7, OUTPUT); // Tail light pinMode(11, INPUT_PULLUP); //"Brakes" button } void loop(){ //if the pushbutton is pressed, hold the LED on if (digitalRead(11) == LOW) { //if the button is pressed digitalWrite(7, HIGH); //the code between the braces is the 'action' } else { // an else statement runs when the 'if' condition isn't true digitalWrite(7,HIGH); //otherwise, turn LED off with a LOW command } } // (c) 2022 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.