In our last project, we added in the use of the buttons as inputs and we tested the sequence of button presses to determine if they were correct. In this project, we'll add sound to our LED flashes.
First, we need to import the sound function we'll use and initialize a list of four sounds -- one for each of the LEDs. We'll also initialize a specific note to play when an incorrect button is pressed (this is for later):
Next, we need to insert our sounds into two locations -- where we flash the sequence of LEDs for the player and where the player presses a button while repeating the sequence. Here is what those two code blocks should be updated to:
Here is what the code for this project should look like at this point -- it should run similarly to the previous project, but with sound added: