1
2
3int temp = 50, cont = 0;
4
5
6void load_all(void) {
7
8 digitalWrite(A2, LOW);
9 digitalWrite(A1, LOW);
10 digitalWrite(A0, LOW);
11 delay(1);
12
13
14 digitalWrite(A2, HIGH);
15 digitalWrite(A1, LOW);
16 digitalWrite(A0, LOW);
17 delay(1);
18
19
20 digitalWrite(A2, LOW);
21 digitalWrite(A1, HIGH);
22 digitalWrite(A0, LOW);
23 delay(1);
24
25
26 digitalWrite(A2, HIGH);
27 digitalWrite(A1, HIGH);
28 digitalWrite(A0, LOW);
29 delay(1);
30
31
32 digitalWrite(A2, LOW);
33 digitalWrite(A1, LOW);
34 digitalWrite(A0, HIGH);
35 delay(1);
36
37
38 digitalWrite(A2, HIGH);
39 digitalWrite(A1, LOW);
40 digitalWrite(A0, HIGH);
41 delay(1);
42
43
44 digitalWrite(A2, LOW);
45 digitalWrite(A1, HIGH);
46 digitalWrite(A0, HIGH);
47 delay(1);
48
49
50 digitalWrite(A2, HIGH);
51 digitalWrite(A1, HIGH);
52 digitalWrite(A0, HIGH);
53 delay(1);
54
55}
56
57
58void scrolling(int t) {
59 PORTB = 0x00;
60 digitalWrite(7, HIGH);
61 delay(t);
62 digitalWrite(7, LOW);
63
64 digitalWrite(8, HIGH);
65 delay(t);
66 digitalWrite(8, LOW);
67
68 digitalWrite(9, HIGH);
69 delay(t);
70 digitalWrite(9, LOW);
71
72 digitalWrite(10, HIGH);
73 delay(t);
74 digitalWrite(10, LOW);
75
76 digitalWrite(11, HIGH);
77 delay(t);
78 digitalWrite(11, LOW);
79
80 digitalWrite(12, HIGH);
81 delay(t);
82 digitalWrite(12, LOW);
83
84 digitalWrite(13, HIGH);
85 delay(t);
86 digitalWrite(13, LOW);
87
88}
89
90
91void one(void) {
92 PORTD = 0xff;
93 load_all();
94 while (1) {
95 scrolling(temp);
96
97 temp = temp - 2;
98
99 if (temp <= 0) {
100 temp = 1;
101 cont++;
102 if (cont == 1000) {
103 cont = 0;
104 temp = 100;
105 }
106 }
107
108 }
109}
110
111void setup() {
112 DDRD = 0xff;
113 DDRB = 0xff;
114 DDRC = 0xff;
115
116}
117
118void loop() {
119 one();
120}
121