Example project · Displays & sensors
PIR motion light
A PIR motion sensor lighting an LED when it detects movement. Press “Trigger motion” in the PIR’s Inspector; OUT pulses high for a couple of seconds and the LED follows.

What's on the bench
- Battery
- ESP32-C3
- LED
- PIR Motion
- Resistor
The code
This MicroPython script runs on the emulated board every boot; edit it in the Code tab.
from machine import Pin import time pir = Pin(0, Pin.IN) led = Pin(1, Pin.OUT, value=0) while True: m = pir.value() led(m) print('MOTION' if m else 'clear') time.sleep_ms(200)