Light Sensor(CDS): 두 판 사이의 차이
(Created page with "{{#seo:|title=아두위키 : 아두이노 조도 센서 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 조도 센서, 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 조도 센서를 사용하는 방법(기본정보, 회로, 예제 코드)를 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} [[File:조도센서대표이미지.jpg|center|class=coders100]...") |
잔글편집 요약 없음 |
||
| 9번째 줄: | 9번째 줄: | ||
* 10KΩ Resistor | * 10KΩ Resistor | ||
* Jumper Cables | * Jumper Cables | ||
* [[LED 5mm|LED (for example usage)]] | * [[LED 5mm EN|LED (for example usage)]] | ||
== Connection == | == Connection == | ||
2025년 3월 27일 (목) 13:59 판

A sensor whose resistance decreases as the light intensity increases.
Required Hardware
- Light Sensor (CDS)
- Arduino Board
- 10KΩ Resistor
- Jumper Cables
- LED (for example usage)
Connection
Even without using an LED, you can check the light sensor measurement values on the serial monitor.


Example Code
This example outputs the light sensor values to the serial monitor and changes the brightness of the LED based on the sensor values.
#define A_cds A0
void setup()
{
// Set serial communication baud rate
Serial.begin(9600);
}
void loop()
{
// Reads the voltage value coming in through analogRead.
// analogRead maps a voltage range of 0~5V to an integer value of 0~1024.
double value = analogRead(A_cds);
Serial.print("value : ");
Serial.println(value);
delay(1000);
}
Execution Result
