The example program for RenBED to deomonstrate ticker and the Seven Segment Display Driver
Dependencies: SevenSegmentDisplay mbed
Fork of mbed_blinky by
main.cpp
- Committer:
- jf1452
- Date:
- 2014-02-10
- Revision:
- 2:249f10554a91
- Parent:
- 1:ff60bc1461ed
File content as of revision 2:249f10554a91:
/******************************************************************************* * This program demonstrates how to drive the seven segment display * * * * Jon Fuge * * V1.0 10/2/2014 First issue of code * *******************************************************************************/ #include "mbed.h" #include "SevenSegmentDisplay.h" // Options to instantiate SevenSegmentDisplay are... // FADE: causes the number changes to fade in smoothly // INSTANT: causes the an instant number change // + FLASH: causes the display to flash SevenSegmentDisplay segmentled( FADE ); DigitalOut myled(P0_21); void Counter(); Ticker timeout; //Create an instance of class Ticker called timeout. int main() { timeout.attach(&Counter, 1); while(1) { myled = 1; wait(0.2); myled = 0; wait(0.2); } } void Counter() { static int Count = 0; segmentled.DisplayInt(Count); Count = Count + 1; if (Count == 100) Count = 0; }