Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions