-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanalogRead.ino
More file actions
37 lines (34 loc) · 1.04 KB
/
analogRead.ino
File metadata and controls
37 lines (34 loc) · 1.04 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
/*
[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
----------
*/
void setup()
{
Serial.begin(115200);
}
void loop()
{
// 10-bit ADC(0~1023)
unsigned int A0_value = analogRead(A0);
unsigned int A1_value = analogRead(A1);
unsigned int A2_value = analogRead(A2);
unsigned int A3_value = analogRead(A3);
Serial.print("A0_Value["); Serial.print(A0_value); Serial.print("] ");
Serial.print("A1_Value["); Serial.print(A1_value); Serial.print("] ");
Serial.print("A2_Value["); Serial.print(A2_value); Serial.print("] ");
Serial.print("A3_Value["); Serial.print(A3_value); Serial.println("]");
delay(1000);
}