/*Outreach splicing game*/ // Constants - their value won't change. // They're used here to set pin numbers: ?????add a constant variable called buttonPin and set it's value to 0, because the button will be put in pin 0????? // the number of the pushbutton pin ?????to add a consant variable, put the keyword "const" before the variable type "int"??? // Variables - their values will change: int gameCounter = 0; // variable for checking how many times the button has been pressed int gSpeed = 800; // initial game speed - time in milliseconds each led is turned on int prevButtonState = LOW; // Variable to ensure two button presses are NOT recorded if the button is simply held down int currentButtonState = LOW; // Variable to ensure two button presses are NOT recorded if the button is simply held down int firstPress = 0; // Variable to record which LED was active when the button was pressed the first time int secondPress = 0; // Variable to record which LED was active when the button was pressed the second time bool buttonPressed = false; // Variable to tell you when to end for loops // the setup function runs once when you press reset or power the board void setup() { // Initialize all digital pins as output pins. ?????Setup all the LED pins - pins 1 to 13 - using a for loop. This should be the same as in exercise 3????? // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } //STUDENTS - IGNORE THIS FOR NOW //used in loop for logic void levelUp(int press1, int press2){ if (press1 == 4 && press2 == 9){ //Level PASSED!! Level up! //update gSpeed value gSpeed = gSpeed/2; } else{ //FAILED TO SPLICE. Speed stays the same } //Flash winning values for(int j = 0; j<6; j = j + 1){ digitalWrite(press1, HIGH); delay(500); //0.5 seconds on digitalWrite(press1, LOW); digitalWrite(press2, HIGH); delay(500); //0.5 seconds on digitalWrite(press2, LOW); } } //STUDENTS - IGNORE THIS FOR NOW //handle what happens when button is pressed bool gameLogic(int i){ bool output = false; //get current push button state currentButtonState = ! digitalRead(buttonPin); if(currentButtonState == HIGH){//button is pressed //check to see if button is just being held down if(prevButtonState == HIGH){ //pass. Button is being held down. 'Previous button state' remains high } else{ //New button press //increment game counter gameCounter = gameCounter + 1; //test to see if time to end game if(gameCounter == 2){ //end game //set game counter to 0 gameCounter = 0; //set second press position identifier secondPress = i; //turn off most recent led digitalWrite(i, LOW); //display result and continue/level up if(firstPress0; i = i - 1){ /* turn the LED on (HIGH is the voltage level) */ ?????Turn the current LED on????? // wait for designated time for(int k = 0; k