loading
ButtonHero is a game made on an Arduino that involves the use of buttons, LEDs, wires, and resistors. In this game, you have to hit the corresponding button to the light that is randomly selected before the light changes. You start with 5 lives and missing or being too slow subtracts one life. The high score is 56. Good luck!


Video of the Serial Monitor of the same game: http://screencast.com/t/PTaS3JwUu

Step 1: Supplies

Supplies include:
• 4 LEDs
• 4 pushbuttons
• 1 Arduino (we used a Dueilanove)
• 4  8.2kΩ resistors
• 4  100Ω resistors
• 4  0.56kΩ resistors
• lots of wire
<p>Hello. I was trying to make this project and I have completed all the steps. However, I am having trouble with the LEDs. The LEDs are flashing but they always flash on the 6th time as if its GAME OVER, even when I click the correct corresponding button. Please help me. Thanks.</p>
<p>It's as if the buttons are unresponsive.</p>
<p>This isn't really something I can help you troubleshoot. It sounds like a software issue, so you'll have to step through your code to find the problem. It's likely you have a typo somewhere or conditions are triggering early due to an oversight on when they will be triggered.</p>
<p>Are you sure there is no error in the code because I have discussed with my teachers and even a specialist who have all claimed that the code was the issue. This is because what else can be the issue? When I click on the correct buttons, the serial monitor does not register them. However, the specialist checked each button and said that the circuit was functioning properly.</p>
An unavoidable part of programming is troubleshooting and debugging. It can take hours to days and, in extreme cases, months. It involves close examination of the code and lots of Googling. It's frustrating and tedious, but it must be done to find and solve your mistakes. <br><br>I wrote this Instructable years ago. I barely remember how it works, and I don't have time to get back into it. <br><br>This is something you need to troubleshoot. I can't help you on this specific issue. I don't know what your code is or what your circuit looks like because I am not there. Sorry, but I cannot help you here. Please stop asking me. It sounds like you have some very supportive advisers who can help you on-site. They are much more suited to help you then I am. Take their advice. You said your specialist said there's an issue with your code. Start troubleshooting there.
<p>I appreciate you trying to put you full effort in helping me. Thank you, and I will take your advice. </p>
<p>I feel like the reason why it stops after 6 is because the &quot;byte health&quot; = 6. I changed it to a random number but that only affects the first time it is played, and after that, it flashes after 6. I feel like the reason is because of this part in the code below. How can I make it so the score is not fixed. </p><p>if(health==6){</p><p> health=5;</p><p> }</p><p> if(health==5){</p><p> Serial.println(&quot;| Lives: &lt;3 &lt;3 &lt;3 &lt;3 &lt;3 |&quot;);</p><p> Serial.println(&quot;| |&quot;);</p><p> }</p><p> else if(health==4){</p><p> Serial.println(&quot;| Lives: &lt;3 &lt;3 &lt;3 &lt;3 |&quot;);</p><p> Serial.println(&quot;| |&quot;);</p><p> }</p><p> else if(health==3){</p><p> Serial.println(&quot;| Lives: &lt;3 &lt;3 &lt;3 |&quot;);</p><p> Serial.println(&quot;| |&quot;);</p><p> }</p><p> else if(health==2){</p><p> Serial.println(&quot;| Lives: &lt;3 &lt;3 |&quot;);</p><p> Serial.println(&quot;| |&quot;);</p><p> }</p><p> else if(health==1){</p><p> Serial.println(&quot;| Lives: &lt;3 |&quot;);</p><p> Serial.println(&quot;| |&quot;);</p><p> }</p><p> else if(health==0){</p><p> Serial.println(&quot;| Lives: |&quot;);</p><p> Serial.println(&quot;| YOU LOSE! |&quot;);</p><p> health = 6;</p><p> score = 0;</p><p> }</p><p> Serial.print(&quot;+---------------------------------------------------------------+&quot;);</p><p> updateScreen=false;</p><p> }</p><p> }</p><p> lostHealth=false;</p>
<p>What's the code if I will use LCD 16x2? the Liquid Crystal Display?</p>
<p>It depends on your display. Google the name of your display and there will usually be a library for you to use.</p>
<p>Can you help me with my issue? Thanks.</p>
<p>I made it! But i need more buttons! How to add and do the coding?</p>
<p>It works! First try! Thank you for the easy to follow instructable. I like being able to see where everything goes. The pictures were definitely helpful, since there wasn't a schematic to go by. I had to use different resistors cause I didn't have the ones you suggested. But other than that I didn't have any problems. Thanks again. Great job! </p>
<p>Thanks! If you were looking for the more traditional schematic, you can download the Fritzing file in Step 2 and switch the view to schematic. Fritzing is a great piece of circuit creation software and is available here: http://fritzing.org/home/</p>
dude you totally copied this doug. i had this idea before you but you posted this first. youre a phony. A BIG FAT PHONY
<p>you're just lazy</p>
ARDUINO DOUGSTER 123456789
I noticed that you used random insted of true random. If you use the &quot;normal&quot; random it will use the same sequence. Therefor it is not really random. Thankfully on the arduino site you can get the true random! Great idea.
Great work !! <br>How come you didnt hade debouncing or interrupts ???
Nice 'ible! <br>One suggestion to make it easier is to eliminate the 8k2 resistors and the 560 ohm resistors by using the arduino's internal pull-up resistors on the input pins and wire the buttons to ground when pressed instead of 5v (and change the SW appropriately). Saves 8 resistors. <br> <br>Best Wishes

About This Instructable

26,071views

58favorites

License:

More by EpicWolverine:ButtonHero 
Add instructable to: