The program uses the BusOut Class to make a counter
Dependencies: mbed
Fork of BusOut_HelloWorld by
main.cpp@2:76f66b714f20, 2014-10-16 (annotated)
- Committer:
- shiyilei
- Date:
- Thu Oct 16 07:39:18 2014 +0000
- Revision:
- 2:76f66b714f20
- Parent:
- 0:717993c337df
- Child:
- 3:b83cb0af21b0
learn the BusOut Class to make a counter
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shiyilei | 2:76f66b714f20 | 1 | /*********************************************** |
shiyilei | 2:76f66b714f20 | 2 | *file name :number show |
shiyilei | 2:76f66b714f20 | 3 | *creator: Jacob Shi |
shiyilei | 2:76f66b714f20 | 4 | *Time :2014/10/16 |
shiyilei | 2:76f66b714f20 | 5 | *Description: The program use the BusOut Class to |
shiyilei | 2:76f66b714f20 | 6 | *realize a counter(0-9) |
shiyilei | 2:76f66b714f20 | 7 | *************************************************/ |
mbed_official | 0:717993c337df | 8 | #include "mbed.h" |
shiyilei | 2:76f66b714f20 | 9 | char data[10]={0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; |
shiyilei | 2:76f66b714f20 | 10 | BusOut port(p21, p22, p23, p24,p25,p26,p27,p28); |
shiyilei | 2:76f66b714f20 | 11 | |
mbed_official | 0:717993c337df | 12 | int main() { |
mbed_official | 0:717993c337df | 13 | while(1) { |
shiyilei | 2:76f66b714f20 | 14 | for(int i=0; i<10; i++) { |
shiyilei | 2:76f66b714f20 | 15 | port = data[i]; |
shiyilei | 2:76f66b714f20 | 16 | wait(1); |
mbed_official | 0:717993c337df | 17 | } |
mbed_official | 0:717993c337df | 18 | } |
mbed_official | 0:717993c337df | 19 | } |