ES-19PertengahanPremium
Automatic Lighting with the ESP32 PIR Motion Sensor
In this project an HC-SR501 PIR motion sensor detects someone entering the room and turns on an LED automatically. millis() tracks how long the LED stays on: each HIGH reading refreshes the last-motion time, and the LED turns off at least 10 seconds after the last HIGH. The code also waits 50 ms with delay(50) in every loop, so the loop is not fully non-blocking. Great for stairs, hallways, bathrooms or closet lighting.
4.4(24)
38 selesai
No more fumbling for the light switch in a dark hallway: the light comes on by itself as soon as someone walks in. The motion sensor notices body heat, the ESP32 turns on the LED and switches it off 10 seconds after the last movement, and if anyone moves in the meantime the countdown starts over. It is the first step towards smart lighting for stairs, cupboards or the bathroom.
Kod Sumber
Projek ini juga disertakan dengan blok. Seperti kod, blok dibuka dengan Premium. Apakah pengekodan blok?
Kandungan Premium
Kod sumber, versi blok dan soalan lazim projek ini terbuka untuk ahli Premium.
- Semua Kod Projek
- Versi blok
- Soalan Lazim
