The example program for RenBED to deomonstrate ticker and the Seven Segment Display Driver
Dependencies: SevenSegmentDisplay mbed
Fork of RenBEDCounter by
Revision 4:47649aacd984, committed 2014-05-08
- Comitter:
- jf1452
- Date:
- Thu May 08 13:36:13 2014 +0000
- Parent:
- 3:70799f249b83
- Commit message:
- Update
Changed in this revision
DebounceIn.lib | Show diff for this revision Revisions of this file |
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/DebounceIn.lib Thu May 08 08:36:17 2014 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/AjK/code/DebounceIn/#31ae5cfb44a4
--- a/main.cpp Thu May 08 08:36:17 2014 +0000 +++ b/main.cpp Thu May 08 13:36:13 2014 +0000 @@ -40,25 +40,25 @@ int main() { - mybutton.mode(PullUp); // Set switch input to pull-up mode - segmentled.DisplayDigits(36,36); + mybutton.mode(PullUp); // Set switch input to pull-up mode + segmentled.DisplayDigits(36,36); // Turn display off - while (mybutton == 0) {} // Wait for button change - wait(5); // wait for five seconds before starting game - myled = 1; // Turn the LED on - segmentled.DisplayDigits(16,24); // Display Go - timeout.attach_us(&Counter, 10000); // Set up a 10ms counter for Hundreths of a second + while (mybutton == 0) {} // Wait for button change + wait(5); // wait for five seconds before starting game + myled = 1; // Turn the LED on + segmentled.DisplayDigits(16,24); // Display Go + timeout.attach_us(&Counter, 10000); // Set up a 10ms counter for Hundreths of a second while ((mybutton == 1) && (iCount <99)) {} // Wait for button change - timeout.detach(); // Stop the timer + timeout.detach(); // Stop the timer - segmentled.DisplayInt(iCount); // Display reaction time. - myled = 0; // Turn the LED off + segmentled.DisplayInt(iCount); // Display reaction time. + myled = 0; // Turn the LED off while (1) {}; } void Counter() { - iCount = iCount + 1; + iCount = iCount + 1; // Count hundreths of a second } \ No newline at end of file