Skip to content

Commit 3b24220

Browse files
committed
Fix LAB; include loop
1 parent e9fdf44 commit 3b24220

File tree

2 files changed

+74
-0
lines changed

2 files changed

+74
-0
lines changed

부품&연결방법/온도센서.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,11 @@
6868
Serial.print (temp_F);
6969
Serial.println(" F");
7070
}
71+
72+
void loop( ) {
73+
readTemperature();
74+
delay(1000);
75+
}
7176
```
7277

7378
### 🔎 비교
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
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 신호 -> 단음 재생

0 commit comments

Comments
 (0)