-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTM1637dot.ino
More file actions
77 lines (66 loc) · 1.71 KB
/
TM1637dot.ino
File metadata and controls
77 lines (66 loc) · 1.71 KB
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
/* https://github.com/avishorp/TM1637
https://robojax.com/learn/arduino/robojax-TM1637_display_manual.pdf
[ATmega32U4 Pinout]
----------
TX=1-| ProMicro |-RAW
RX=0-| |-GND
GND-| |-RST
GND-| |-VCC
SDA=2-| |-21=A3
SCL=3(~)-| |-20=A2
A6=4-| |-19=A1
5(~)-| |-18=A0
A7=6(~)-| |-15=SCLK
7-| |-14=MISO
A8=8-| |-16=MOSI
A9=9(~)-| |-10(~)=A10
----------
*/
#include <TM1637Display.h>
// Module connection pins (Digital Pins)
#define CLK 4
#define DIO 5
#define readV0 A0
#define readV1 A1
#define readV2 A2
#define readV3 A3
// The amount of time (in milliseconds) between tests
#define DELAY 3000
TM1637Display display(CLK, DIO);
unsigned int V0 = 0;
unsigned int V1 = 0;
unsigned int V2 = 0;
unsigned int V3 = 0;
void setup()
{
Serial.begin(115200);
display.setBrightness(7); // 0~7, 7(maxBright)
display.clear();
pinMode(readV0, INPUT);
pinMode(readV1, INPUT);
pinMode(readV2, INPUT);
pinMode(readV3, INPUT);
}
void loop()
{
V0 = analogRead(readV0);
display.showNumberDec(V0, false);
Serial.print("V0 :");
Serial.println(V0);
delay(DELAY);
V1 = analogRead(readV1);
display.showNumberDec(V1, false);
Serial.print("V1 :");
Serial.println(V1);
delay(DELAY);
V2 = analogRead(readV2);
display.showNumberDec(V2, false);
Serial.print("V2 :");
Serial.println(V2);
delay(DELAY);
V3 = analogRead(readV3);
display.showNumberDec(V3, false);
Serial.print("V3 :");
Serial.println(V3);
delay(DELAY);
}