1int digits [10][7]{
2 {1,1,1,1,1,1,0},
3 {0,1,1,0,0,0,0},
4
5 {1,1,0,1,1,0,1},
6 {1,1,1,1,0,0,1},
7
8 {0,1,1,0,0,1,1},
9 {1,0,1,1,0,1,1},
10 {1,0,1,1,1,1,1},
11
12 {1,1,1,0,0,0,0},
13 {1,1,1,1,1,1,1},
14
15 {1,1,1,1,0,1,1}
16};
17void setup() {
18 pinMode(0, OUTPUT);
19 Segment A
20 pinMode(1, OUTPUT);
21 pinMode(2, OUTPUT);
22 C
23 pinMode(3, OUTPUT);
24 pinMode(4, OUTPUT);
25
26 pinMode(5, OUTPUT);
27 pinMode(6, OUTPUT);
28}
29void
30 display_digit(int d){
31 if (digits[d][0]==1) digitalWrite(0, LOW); else digitalWrite(0,
32 HIGH);
33 if (digits[d][1]==1) digitalWrite(1, LOW); else digitalWrite(1,
34 HIGH);
35 if (digits[d][2]==1) digitalWrite(2, LOW); else digitalWrite(2,
36 HIGH);
37 if (digits[d][3]==1) digitalWrite(3, LOW); else digitalWrite(3,
38 HIGH);
39 if (digits[d][4]==1) digitalWrite(4, LOW); else digitalWrite(4,
40 HIGH);
41 if (digits[d][5]==1) digitalWrite(5, LOW); else digitalWrite(5,
42 HIGH);
43 if (digits[d][6]==1) digitalWrite(6, LOW); else digitalWrite(6,
44 HIGH);
45}
46void loop() {
47 for (int i=0;i<10;i++) {
48 display_digit(i);
49
50 delay(1000);
51 }
52}
53