Go Down

Topic: Everybody hates Newbies...BUT (Read 530 times) previous topic - next topic

CrossRoads

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.

oric_dan

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


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.

CrossRoads

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: [Select]

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.
}
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.

Go Up