Light Sensor(CDS): 두 판 사이의 차이
잔글편집 요약 없음 |
잔글편집 요약 없음 |
||
| 5번째 줄: | 5번째 줄: | ||
* Light Sensor (CDS) | * Light Sensor (CDS) | ||
* | * Arduino Board | ||
* | * 10KΩ Resistor | ||
* | * Jumper Wires | ||
* [[LED 5mm EN|LED]] (used in example) | * [[LED 5mm EN|LED]] (used in example) | ||
2025년 3월 27일 (목) 14:01 기준 최신판

This is a sensor whose resistance decreases as the brightness increases.
Required Hardware
- Light Sensor (CDS)
- Arduino Board
- 10KΩ Resistor
- Jumper Wires
- LED (used in example)
Connection
Even without using an LED, you can check the light sensor readings through the serial monitor.


Example Code
This example prints the light sensor value to the serial monitor and adjusts the LED brightness based on the sensor value.
#define A_cds A0
void setup()
{
// Set the serial communication baud rate
Serial.begin(9600);
}
void loop()
{
// Read voltage input via analogRead
// analogRead maps 0–5V to integer values between 0–1024
double value = analogRead(A_cds);
Serial.print("value : ");
Serial.println(value);
delay(1000);
}
Output Result
