我是看着胡老师的文档做的,现在也懒得写了。把文档放在这了http://pan.baidu.com/s/1c07D02k,胡老师写的文档真是太详细了
下面只贴一下代码吧,也没有注释。
led.h
#define LED_A 29
#define LED_B 27
#define LED_C 24
#define LED_D 22
#define LED_E 21
#define LED_F 28
#define LED_G 25
#define LED_H 23
#define LED_COM1 0
#define LED_COM2 2
#define LED_COM3 3
#define LED_COM4 12
#define LED_D1 LED_E
#define LED_D2 LED_D
#define LED_D3 LED_H
#define LED_D4 LED_C
#define LED_D5 30
#define LED_D6 31
#define LED_D7 11
#define LED_D8 10
int tube_segment[]={LED_A, LED_B, LED_C, LED_D, LED_E, LED_F, LED_G, LED_H};
int number_segments[]={0b11111100, 0b01100000, 0b11011010, 0b11110010, 0b01100110, 0b10110110, 0b10111110,0b11100000, 0b11111110, 0b11100110};
int tube_coms[]={LED_COM1, LED_COM2, LED_COM3, LED_COM4};
int led_segment[]={LED