Back to Grade 9 lesson →
Grade 9 · Campus light-alert prototype

ESP32 light-alert simulation

SIMULATED INPUT — synthetic ADC counts demonstrate the program; test and calibrate the real circuit separately.

Simulated light sensor connected to an ESP32 and warning LED ESP32 GPIO34 → GPIO25 Light sensorDecisionWarning LED
INPUT · Synthetic ADC counts2200
OUTPUT · Warning LEDOFF

Above 1800: turn the warning LED OFF.

  • Below 1400: turn ON.
  • Above 1800: turn OFF.
  • Between 1400 and 1800, including both boundaries: keep the previous state.

ADC counts are not lux. Example thresholds: 1400 and 1800.

Optional circuit reference — teacher check first

Classic ESP32: 3V3 → LDR → GPIO34 junction → 10 kΩ resistor → GND. GPIO25 → 330 Ω resistor → LED → GND.

Check the actual board labels and LED polarity. Disconnect power before changing wires. Never connect 5 V to an ESP32 input. The warning LED is not a room lamp.