-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathDigit7SegmentDemo.ino
77 lines (57 loc) · 1.2 KB
/
Digit7SegmentDemo.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
/* Include DigitLedDisplay Library */
#include "DigitLedDisplay.h"
/* Arduino Pin to Display Pin
7 to DIN,
6 to CS,
5 to CLK */
DigitLedDisplay ld = DigitLedDisplay(7, 6, 5);
void setup() {
/* Set the brightness min:1, max:15 */
ld.setBright(10);
/* Set the digit count */
ld.setDigitLimit(8);
}
void loop() {
/* Prints data to the display */
ld.printDigit(12345678);
delay(500);
ld.clear();
ld.printDigit(22222222);
delay(500);
ld.clear();
ld.printDigit(44444444);
delay(500);
ld.clear();
for (int i = 0; i < 100; i++) {
ld.printDigit(i);
/* Start From Digit 4 */
ld.printDigit(i, 4);
delay(50);
}
for (int i = 0; i <= 10; i++) {
/* Display off */
ld.off();
delay(150);
/* Display on */
ld.on();
delay(150);
}
/* Clear all display value */
ld.clear();
delay(500);
for (long i = 0; i < 100; i++) {
ld.printDigit(i);
delay(25);
}
for (int i = 0; i <= 20; i++) {
/* Select Digit 5 and write B01100011 */
ld.write(5, B01100011);
delay(200);
/* Select Digit 5 and write B00011101 */
ld.write(5, B00011101);
delay(200);
}
/* Clear all display value */
ld.clear();
delay(500);
}