## 人体红外传感器 ![](https://img.kancloud.cn/30/55/30556db26cf3596f1106d3be02c131fe_476x576.png) 当`MotionSensor`红外传感器探测到人的时候点亮`LED`灯。 ~~~ from gpiozero import MotionSensor, LED from signal import pause pir = MotionSensor(4) led = LED(16) pir.when_motion = led.on pir.when_no_motion = led.off pause() ~~~