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. 

//Buggy: Turn on and off random Car LED lights void setup(){ //Set each LED as an OUTPUT pinMode(4,OUTPUT); pinMode(5,OUTPUT); pinMode(6,OUTPUT); pinMode(7,OUTPUT); } void loop(){ digitalWrite(random(4,4),HIGH); //Select LED 4,5,6, or 7 and turn it on delay(500); //Delay for 1/2 second digitalWrite(random(8,4),LOW); //Select LED 4,5,6 or 7 and turn it off delay(500); //Delay for 500 milliseconds } // (c) 2024 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.