Photoresistor Light Sensor
Read a light-dependent resistor as part of a voltage divider and inspect its analog reading.

Wire it up
Disconnect power before changing connections. Follow terminal names rather than wire colors.
| From | To | Why it matters |
|---|---|---|
| LDR (sensor1) · 1 | Uno · 5V | Power connection |
| LDR (sensor1) · 2 | Uno · A0 | Match this terminal to the sketch |
| LDR (sensor1) · 2 | Resistor (divider) · 1 | Match this terminal to the sketch |
| Resistor (divider) · 2 | Uno · GND.2 | Ground reference |
The complete sketch
void setup() { Serial.begin(9600); }
void loop() {
Serial.print("light:"); Serial.println(analogRead(A0));
delay(100);
}
The launch buttons use this same code and a matching saved circuit.
Build it step by step
Open a complete project
Launch in Simulator creates a separate Uno sketch and its matching wired circuit. Existing sketches are preserved. Press Run to compile and execute.
Explore the live circuit
Change the LDR resistance in Component Properties. Lower values should produce larger serial samples.
Try it on hardware
Disconnect power while wiring. Match terminal names in the table, select the exact board, Verify, then connect and upload. Check component ratings and power requirements first.
Understand the sketch
Resistance becomes voltage
The LDR connects from 5 V to A0 and a 10 kΩ resistor connects A0 to ground. Lower LDR resistance raises A0. The simulator exposes resistance, not calibrated lux.
If something is different
Values appear reversed
The divider orientation matters. Swapping the LDR and fixed resistor reverses the relationship.
Expected output and tested scope
Serial output follows the voltage-divider light reading; changing modeled resistance changes the ADC sample.
Version 1 · Last source- and build-matched test: 2026-10-25. Actual shipped AVR-GCC WASM compilation and Uno AVR engine execution; no physical hardware test.
Supported tutorial target: Arduino Uno R3 / ATmega328P. Compile: PASS · Modeled execution: PASS. Other boards require a separate review of pins, voltage, libraries and the exact build profile.