use the PortOut Class to make a timetick
Dependencies: mbed
Fork of PortOut_HelloWorld by
Revision 2:fb1498b28a57, committed 2014-10-17
- Comitter:
- shiyilei
- Date:
- Fri Oct 17 01:32:39 2014 +0000
- Parent:
- 1:cdaa5e68a540
- Commit message:
- make the use of the PortOut class to make a timetick
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r cdaa5e68a540 -r fb1498b28a57 main.cpp --- a/main.cpp Sun Sep 21 06:27:16 2014 +0000 +++ b/main.cpp Fri Oct 17 01:32:39 2014 +0000 @@ -1,17 +1,19 @@ -// Toggle all four LEDs - -#include "mbed.h" - -// LED1 = P1.18 LED2 = P1.20 LED3 = P1.21 LED4 = P1.23 -#define LED_MASK 0x00B40000 - -PortOut ledport(Port1, LED_MASK); - +/************************************************* +*file:time counter +*creator:JacobShi +*Time:2014/10/16 +* Description: This is a time downcounter from 9-0 +**************************************************/ +#include "mbed.h" + +char lednumber[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; +PortOut portled(Port0,0x000000ff);/*p0_0~p0_7*/ + int i=0; int main() { - while(1) { - ledport = LED_MASK; - wait(1); - ledport = 0; + while(1) + { + portled=lednumber[i]; + i=(i++)%10; wait(1); } } \ No newline at end of file