Skip to content

Commit 73ddd80

Browse files
committed
use pico_led for MotionSensor example so not relying on second external component
1 parent 92616c4 commit 73ddd80

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed
Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
1-
from picozero import MotionSensor, LED
1+
from picozero import MotionSensor, pico_led
22
from time import sleep
33

44
pir = MotionSensor(2)
55

6-
# Create an LED on pin 25 (built-in LED)
7-
led = LED(25)
8-
96
# Set up event callbacks
10-
pir.when_motion = led.on
11-
pir.when_no_motion = led.off
7+
pir.when_motion = pico_led.on
8+
pir.when_no_motion = pico_led.off
129

1310
# Keep the program running
1411
try:
1512
while True:
1613
sleep(1)
1714
except KeyboardInterrupt:
1815
print("\nShutting down...")
19-
led.off() # Make sure LED is off when exiting
16+
pico_led.off() # Make sure LED is off when exiting

0 commit comments

Comments
 (0)