The example program for mbed pin-compatible platforms
Dependencies: mbed
Fork of mbed_blinky by
Revision 7:2b84b7d000c3, committed 2014-12-09
- Comitter:
- f3d
- Date:
- Tue Dec 09 15:25:12 2014 +0000
- Parent:
- 6:e8cd76f38fa9
- Commit message:
- version 1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
diff -r e8cd76f38fa9 -r 2b84b7d000c3 main.cpp --- a/main.cpp Fri May 09 19:58:03 2014 +0300 +++ b/main.cpp Tue Dec 09 15:25:12 2014 +0000 @@ -1,12 +1,53 @@ #include "mbed.h" -DigitalOut myled(LED1); +BusOut Digits(dp27,dp26,dp25,dp24); +BusOut Segments(dp5,dp6,dp28,dp1,dp2,dp17,dp4); +//d4,dp17,dp2,dp1,dp28,dp6,dp5); +#define SEG_A 1 +#define SEG_B 2 +#define SEG_C 4 +#define SEG_D 8 +#define SEG_E 16 +#define SEG_F 32 +#define SEG_G 64 +const short patterns[]={ \ + SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F ,\ + SEG_B | SEG_C , \ + SEG_A | SEG_B | SEG_D | SEG_E | SEG_G,\ + SEG_A | SEG_B | SEG_C | SEG_D | SEG_G,\ + SEG_B | SEG_C | SEG_F | SEG_G,\ + SEG_A | SEG_C | SEG_D | SEG_F | SEG_G,\ + SEG_A | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G,\ + SEG_A | SEG_B | SEG_C ,\ + SEG_A | SEG_B | SEG_C | SEG_D | SEG_E | SEG_F | SEG_G,\ + SEG_A | SEG_B | SEG_C | SEG_D | SEG_F | SEG_G \ + + }; + +void DisplayNumber(int Number) +{ + Digits=0xe; + Segments=patterns[Number % 10]; + Number = Number / 10; + wait_ms(5); + Digits=0xd; + Segments=patterns[Number % 10]; + Number = Number / 10; + wait_ms(5); + Digits=0xb; + Segments=patterns[Number % 10]; + Number = Number / 10; + wait_ms(5); + Digits=0x7; + Segments=patterns[Number % 10]; + wait_ms(5); +} + int main() { + int Counter=0; while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); + DisplayNumber(Counter++); + } }
diff -r e8cd76f38fa9 -r 2b84b7d000c3 mbed.bld --- a/mbed.bld Fri May 09 19:58:03 2014 +0300 +++ b/mbed.bld Tue Dec 09 15:25:12 2014 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/ \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89 \ No newline at end of file