Question: Problem 2 - LED Game Youre bored and decide to make a game for your friends. In this game, you have 5 LEDs that each

Problem 2 - LED Game

  • Youre bored and decide to make a game for your friends. In this game, you have 5 LEDs that each have their own button. The LEDs are set up in a row. When an LEDs button is pressed, its state changes (meaning if it was on, it turns off, and vice versa). It will also change the state of the two LEDs next to it. For example, if the button for the 4th LED is pressed, the 3rd, 4th, and 5th LED would change states. If the button for the 1st or 5th LED is pressed, the state change wraps around. For example, if the 5th button is pressed, the 4th, 5th, and 1st LED change states. The objective of the game is to figure out what sequence of button presses turns all of the LEDs on.

  • Construct this circuit and corresponding Arduino code for the game. Additionally, comment the correct sequence of button presses at the bottom of the code (you can insert a comment using // in Arduino).

    • Hint: Use arrays!!
    • Can you also send a screenshot of the TinkerCad circuit so that I fully understand the code. Thanks

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!