Pages: [1]   Go Down
Author Topic: Everybody hates Newbies...BUT  (Read 436 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am new to electronics, have some experience of C++ programming. I foolishly volunteered to build a game, someone suggested Arduino. The game I planned was to have six LEDs on a panel, with six pushbuttons, one associated with each LED. When you push the start button, a random LED will flash, and you have to push it's button within say 500ms. If you do, you get a green LED, and the game continues for four more goes (5 green LEDs). Get 5 greens and you win. If you dont push the button in time, you get a red LED and the game ends. I am sure an Arduino chip can do this, but does anyone have a circuit diagram they would lend me. Many thanks for your patience.
Logged

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 33
Posts: 2277
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

http://www.arduino.cc/en/Tutorial/button shows how to use a button.
http://www.arduino.cc/en/Tutorial/Blink shows how to use an LED.

Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Everybody hates Newbies...

Don't feel so bad. We were all noobees once. Besides, electronics is 10X harder than programming.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23839
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So, 6 push buttons, plus a start/reset? and 12 LEDs, that's easy electronics.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31553
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
anyone have a circuit diagram they would lend me.
I have but you must prommiss to give it me back.  smiley-twist

Sorry coudn't resist.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23839
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

circuit design


* LED_game.jpg (52.88 KB, 960x720 - viewed 15 times.)
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 149
Posts: 2790
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

Since OP is an experienced programmer, he will certainly be able to appreciate the 'BlinkWithoutDelay'
sketch found in the IDE under "Files > Examples > 2.Digital". Especially as the game will need something
akin to real-time response.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 443
Posts: 23839
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't imagine it will that difficult - you turn on a  LED, do a direct port read of PORTD, watch for any of bits 2-3-4-5-6-7 to go low, see if the One that went low was the correct one. If more than One went,  user erred or was cheating, Red LED & game over.
Code:
if ( (PORTD & B11111100) == B11111100){
// no button pressed yet, keep looping
}
else{
// see if pressed button matches lit LED, let game continue, or turn on RED LED.
}
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Pages: [1]   Go Up
Jump to: