1D-Pong game based on a LED strip with 150 LPD6803-controlled pixels. Game keeps score for 'best-of-21' game. Written for KL25Z
Diff: GameButton.cpp
- Revision:
- 26:448ee3b0b481
- Parent:
- 21:a554229e884b
--- a/GameButton.cpp Tue Sep 03 22:30:16 2013 +0000 +++ b/GameButton.cpp Sat Sep 07 10:59:26 2013 +0000 @@ -8,15 +8,21 @@ (*intpin).fall(this, &GameButton::PushHandler); m_time = time; m_timeoutactive = false; + inpin = pin; //timeout = new Timeout(m_time); } void GameButton::PushHandler(void) { - pushflag = true; - m_timeoutactive = true; - timeout.attach(this, &GameButton::TimeOutHandler, m_time); - pushhandlercallback(); + DigitalIn input(inpin); + wait_ms(5); + if(!input) + { + pushflag = true; + m_timeoutactive = true; + timeout.attach(this, &GameButton::TimeOutHandler, m_time); + pushhandlercallback(); + } } void GameButton::TimeOutHandler(void)