-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Nixie_Shield_Simple_Counter_Example.ino
121 lines (93 loc) · 3.73 KB
/
Nixie_Shield_Simple_Counter_Example.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
Nixie Shield Simple Counter Example
This example shows how to make a simple nixie counter.
Nixie Shield uses five digital outputs to drive nixie tube.
Pin A0 as on/off line, 13,12,11,10 as an address of nixie tube cathode.
This example code is in the public domain.
http://www.nixietester.com
*/
const int EN = A0; // A0 pin is attached to on/off line
const int A = 13; // 13,12,11,10 pins are attached to address lines
const int B = 12;
const int C = 11;
const int D = 10;
void setup() {
pinMode(EN, OUTPUT); // declare pin A0 as output
pinMode(A, OUTPUT); // declare pins 13,12,11,10 as output
pinMode(B, OUTPUT);
pinMode(C, OUTPUT);
pinMode(D, OUTPUT);
}
void loop() {
delay (1000);
digitalWrite(EN, LOW); //turn on the tube
// set address of the tube cathode '0':
// ___
digitalWrite(A, LOW); // | |
digitalWrite(B, LOW); // | |
digitalWrite(C, LOW); // | |
digitalWrite(D, LOW); // |___|
delay (1000);
// set address of the tube cathode '1':
digitalWrite(A, HIGH); // /|
digitalWrite(B, LOW); // / |
digitalWrite(C, LOW); // |
digitalWrite(D, LOW); // |
delay (1000);
// set address of the tube cathode '2':
// ___
digitalWrite(A, LOW); // |
digitalWrite(B, HIGH); // ___|
digitalWrite(C, LOW); // |
digitalWrite(D, LOW); // |___
delay (1000);
// set address of the tube cathode '3':
// ___
digitalWrite(A, HIGH); // |
digitalWrite(B, HIGH); // ___|
digitalWrite(C, LOW); // |
digitalWrite(D, LOW); // ___|
delay (1000);
// set address of the tube cathode '4':
digitalWrite(A, LOW); // | |
digitalWrite(B, LOW); // |___|
digitalWrite(C, HIGH); // |
digitalWrite(D, LOW); // |
delay (1000);
// set address of the tube cathode '5':
// ___
digitalWrite(A, HIGH); // |
digitalWrite(B, LOW); // |___
digitalWrite(C, HIGH); // |
digitalWrite(D, LOW); // ___|
delay (1000);
// set address of the tube cathode '6':
// ___
digitalWrite(A, LOW); // |
digitalWrite(B, HIGH); // |___
digitalWrite(C, HIGH); // | |
digitalWrite(D, LOW); // |___|
delay (1000);
// set address of the tube cathode '7':
// ___
digitalWrite(A, HIGH); // |
digitalWrite(B, HIGH); // |
digitalWrite(C, HIGH); // |
digitalWrite(D, LOW); // |
delay (1000);
// set address of the tube cathode '8':
// ___
digitalWrite(A, LOW); // | |
digitalWrite(B, LOW); // |___|
digitalWrite(C, LOW); // | |
digitalWrite(D, HIGH); // |___|
delay (1000);
// set address of the tube cathode '9':
// ___
digitalWrite(A, HIGH); // | |
digitalWrite(B, LOW); // |___|
digitalWrite(C, LOW); // |
digitalWrite(D, HIGH); // ___|
delay (1000);
digitalWrite(EN, HIGH); //turn off the tube
}