The example program for RenBED to deomonstrate ticker and the Seven Segment Display Driver
Dependencies: SevenSegmentDisplay mbed
Fork of RenBEDCounter by
Diff: main.cpp
- Revision:
- 4:47649aacd984
- Parent:
- 3:70799f249b83
--- 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