Rocket Blaster Bug Hunt! Test your Troubleshooting.

This code will run, but it has some unexpected behavior. Can you find the error without using the hint?

/* Buggy: Light up the Blaster LEDs when the corresponding button is pressed */ void setup(){ pinMode(7,OUTPUT); //Blaster LED pinMode(8,OUTPUT); //Blaster LED pinMode(12,OUTPUT); //Button pinMode(11,INPUT_PULLUP); //Button } void loop(){ if(digitalRead(12)==LOW){ //if button 12 is pressed digitalWrite(8,HIGH); //turn on LED 8 } if(digitalRead(11)==LOW){ //if button 11 is pressed digitalWrite(7,HIGH); //turn on LED 7 } //the lights will turn off each and every loop, but it will be so fast you won't see it if the button is held. digitalWrite(7,LOW); digitalWrite(8,LOW); } // (c) 2018 Let's Start Coding. License: www.letsstartcoding.com/bsdlicense
 



Need a hint? Click here.