Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 4.59 KB

reflex_subtask_5.asciidoc

File metadata and controls

40 lines (28 loc) · 4.59 KB

Now that you’ve got the mini breadboard circuit wired up properly and connected to the MintDuino, all that’s left is to upload the sketch that will allow two players to see who is the fastest button pusher on the planet.

The game will run as follows:

  1. Turn on the MintDuino – use either a 9V battery or USB power via the FTDI Adapter.

  2. Both player LEDs will light up and stay lit.

  3. Press the Player 2 button to start the game; both player LEDs will turn off.

  4. The Game Light (center LED on the mini breadboard) will blink three times.

  5. After the Game Light blinks three times, a random amount of time will pass before it lights again.

  6. When the Game Light blinks again, each player will try to push his or her button before the other player.

  7. The fastest player’s LED will light up to indicate the winner.

  8. Pressing a button before the delay is over will not light an LED.

  9. Press the Player 2 button to start a new game.

You can download the program for the MintDuino Reflex Game at [URL here] or simply enter the code below into the Arduino IDE:

link:attachments/ReflexGame_draft_v1_0.pde[role=include]

After uploading the sketch to the MintDuino, run the program. When the game first starts the two Player LEDs will light up and stay lit until Player 2 presses his/her button. The Player LEDs will turn off and the Game Light will blink three times. After the third blink, both players will wait until the Game Light blinks a 4th time and then try to be the first player to press their button. The player that wins will have his/her LED light up for four seconds before turning off. Press the Player 2 button to play another game.

Note

If you were able to successfully run Sub-Task 4, then most likely any errors you encounter will be in the sketch for the game. Make certain you’ve uploaded the correct sketch for the game and check that all of your jumper wires are inserted properly in the mini breadboard and the MintDuino. Check that both pushbuttons are pushed securely into the mini breadboard and make certain that all LEDs are wired up correctly with respect to their anode and cathode leads.

There’s no arguing that the MintDuino Reflex Game is relatively simple in terms of gameplay. But think about what you’ve done for a moment – with two pushbuttons, three LEDs, three resistors, and a handful of jumper wires, you transformed the MintDuino and mini breadboard into a functional game. It’s not complex and it’s certainly not pretty to look at, but it works!

Hopefully you’re starting to see the power that resides in that small MintDuino tin and maybe pondering some of your own special projects. If you’re not yet ready to leave the MintDuino Reflex Game and want to dive a little deeper, here are some suggestions on ways to improve the game:

  1. Turn it into a 3 or 4 player game – it might require a slightly larger breadboard, but since you already know how a 2 player game works, it’s not a big jump to program it for additional pushbuttons and LEDs.

  2. Keep Score – Consider adding to the sketch the required code to cause the Mintduino’s status light to blink the Player 1 score, pause three seconds, and then blink the Player 2 score. Or you could add another LED for each player that flashes their score before a new game begins.

  3. Penalize Early Button Pushing - Modify the sketch to check to see if a player pushes his or her button before the Game Light turns on. If the button is pressed before the Game Light blinks, that player automatically loses and the other player’s LED turns on.

  4. Move the Game to a Project Box – with a perf-board and a project box, you could easily give the game a permanent home. With a project box, you could even add an LCD screen to display the score or maybe a speaker that plays a series of beeps instead of lighting the Game LED.

Congratulations on completing the MintDuino Reflex Game! If you’re looking for more projects for your MintDuino, be sure to check out the Make: Projects website at www.makeprojects.com and look over all the Arduino projects for something that catches your eye. Your MintDuino might not look like the Arduinos you see online, but it’s got the same functionality and can easily be substituted. You can also find many more projects on the various Arduino-related websites, including the official Arduino site at www.arduino.org and the community run www.arduino.cc, as well as instructables.com.

Special thanks to Marc De Vinck, Brian Jepson, and Will Price for their assistance with the MintDuino Reflex Game sketch.