Chapter 2. The MintDuino Reflex Game

The MintDuino Reflex Game will test the reflexes of two players. The game takes place on the mini breadboard, with each player waiting to push a button when an LED (the Game Light) in the center of the breadboard lights up. The Game Light will light up after a random amount of time has passed (something between, say, 5 and 10 seconds). Whichever player pushes their button first after the Game Light LED lights up wins, and a green LED will light up on the side of the winning player.

That’s The Big Project—but let’s break it down into four subtasks that will help us understand the proper wiring of the MintDuino, as well as the electronics components and programming elements required:

  1. Wire up and program the MintDuino to light an LED—this will help us to not only light the Game Light but also the winning player’s green LED.

  2. Wire up and light an LED after a Random Wait Time—we will learn how to light an LED after waiting a random amount of time.

  3. Wire up and program an LED to light when the pushbutton is pressed—this will help us to understand the proper wiring of a pushbutton as well as how to use it as a trigger for another event (in this case, lighting an LED).

  4. Wire and program two pushbuttons to light up a matching LED when pressed—here, we’ll figure out how to trigger the correct LED when its paired pushbutton is pressed.

Once we understand what’s required in order to light LEDs, wait a random amount of time, and test for pushbuttons to be pressed, we can pull it all together and build the MintDuino Reflex Game. The fact that we’ll have multiple LEDS shouldn’t be a problem—if we know how to light one, well, we can light two…or three. And if we know how to determine if a pushbutton has been pressed, we can probably figure out how to detect which of two pushbuttons has been pressed. Then we add some code to start the game, check for a premature button push, and reset the game…and we’re in business.

Note

This MintDuino Notebook will provide you with the sample code required to test various circuits and electronics components, but it will not be able to provide a comprehensive tutorial on programming the MintDuino (or an Arduino). If you need a better understanding of the programming language used to create MintDuino sketches, you’ll want to turn to a variety of online and printed sources designed to teach beginning Arduino programming. Make: Arduino, at http://makezine.com/arduino/, is a great starting point. You’ll find videos, projects, books, and more there.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset