use the PortOut Class to make a timetick

Dependencies:   mbed

Fork of PortOut_HelloWorld by mbed official

Committer:
shiyilei
Date:
Fri Oct 17 01:32:39 2014 +0000
Revision:
2:fb1498b28a57
Parent:
0:9bbfdb1487ff
make the use of the PortOut class to make a timetick

Who changed what in which revision?

UserRevisionLine numberNew contents of line
shiyilei 2:fb1498b28a57 1 /*************************************************
shiyilei 2:fb1498b28a57 2 *file:time counter
shiyilei 2:fb1498b28a57 3 *creator:JacobShi
shiyilei 2:fb1498b28a57 4 *Time:2014/10/16
shiyilei 2:fb1498b28a57 5 * Description: This is a time downcounter from 9-0
shiyilei 2:fb1498b28a57 6 **************************************************/
shiyilei 2:fb1498b28a57 7 #include "mbed.h"
shiyilei 2:fb1498b28a57 8
shiyilei 2:fb1498b28a57 9 char lednumber[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
shiyilei 2:fb1498b28a57 10 PortOut portled(Port0,0x000000ff);/*p0_0~p0_7*/
shiyilei 2:fb1498b28a57 11 int i=0;
mbed_official 0:9bbfdb1487ff 12 int main() {
shiyilei 2:fb1498b28a57 13 while(1)
shiyilei 2:fb1498b28a57 14 {
shiyilei 2:fb1498b28a57 15 portled=lednumber[i];
shiyilei 2:fb1498b28a57 16 i=(i++)%10;
mbed_official 0:9bbfdb1487ff 17 wait(1);
mbed_official 0:9bbfdb1487ff 18 }
mbed_official 0:9bbfdb1487ff 19 }