File tree Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Expand file tree Collapse file tree 2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change 68
68
Serial .print (temp_F);
69
69
Serial .println (" F" );
70
70
}
71
+
72
+ void loop ( ) {
73
+ readTemperature ();
74
+ delay (1000 );
75
+ }
71
76
```
72
77
73
78
### 🔎 비교
Original file line number Diff line number Diff line change
1
+ # 📌 조도 센서
2
+
3
+ - 광량과 저항 반비례
4
+
5
+ 어둡 -> 저항大 , 밝 -> 저항小
6
+
7
+ - CdS 조도센서 : 느린 반응속도, 정밀X
8
+
9
+ ### ✔ 연결방법
10
+
11
+ ![ image] ( https://user-images.githubusercontent.com/54584063/84291721-74163f00-ab80-11ea-9b74-13c84f8bdc91.png )
12
+
13
+
14
+ <br ><br >
15
+
16
+ ### ✔ 순서
17
+
18
+ - 1 . 양자화된 값 읽기(0-1023)
19
+
20
+ - int reading = analogRead(56);
21
+
22
+ - 2 . 실제 전압으로 변환(기준:5V)
23
+
24
+ - float voltage = reading* 5.0 / 1024.0;
25
+
26
+ <br ><br >
27
+
28
+ ### ✔ LAB
29
+
30
+ - 조도센서 값 읽기
31
+
32
+ ``` js
33
+ void setup (){
34
+ Serial .begin (9600 ); // 직렬 포트 초기화
35
+ }
36
+
37
+ void readIlluminance () {
38
+ // 조도 센서 읽기
39
+ int reading = analogRead (56 ); // 양자화 된 값
40
+ Serial .print (" ADC : " );
41
+ Serial .print (reading);
42
+
43
+ // ADC 반환 값 -> 전압
44
+ float voltage = reading * 5.0 / 1024.0 ; // 전압
45
+ Serial .print (" , Voltage : " );
46
+ Serial .println (voltage);
47
+ }
48
+
49
+ void loop ( ) {
50
+ readIlluminance ();
51
+ delay (1000 );
52
+ }
53
+
54
+ ```
55
+
56
+
57
+ ### 🔎 비교
58
+
59
+ - 센서
60
+
61
+ - 아날로그 입력 (ADC 필요)
62
+
63
+ - ex: 온도센서, 조도센서
64
+
65
+ - 스피커(" pitch" 라이브러리)
66
+
67
+ - 아날로그 출력
68
+
69
+ - PWM 신호 - > 단음 재생
You can’t perform that action at this time.
0 commit comments