Skip to content

Commit 92616c4

Browse files
committed
Remove function calls from callbacks example and increased bouncetime to 1.00 for MotionSensor Class
1 parent ee33c27 commit 92616c4

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

docs/examples/motion_sensor_callbacks.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,9 @@
66
# Create an LED on pin 25 (built-in LED)
77
led = LED(25)
88

9-
10-
def motion_detected():
11-
led.on()
12-
13-
14-
def no_motion():
15-
led.off()
16-
17-
189
# Set up event callbacks
19-
pir.when_motion = motion_detected
20-
pir.when_no_motion = no_motion
10+
pir.when_motion = led.on
11+
pir.when_no_motion = led.off
2112

2213
# Keep the program running
2314
try:

picozero/picozero.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2015,10 +2015,10 @@ class MotionSensor(DigitalInputDevice):
20152015
The bounce time for the device. If set, the device will ignore
20162016
any motion events that happen within the bounce time after a
20172017
motion event. This is useful to prevent false triggers.
2018-
Defaults to 0.02 seconds.
2018+
Defaults to 1 seconds.
20192019
"""
20202020

2021-
def __init__(self, pin, pull_up=False, bounce_time=0.02):
2021+
def __init__(self, pin, pull_up=False, bounce_time=1.00):
20222022
super().__init__(pin=pin, pull_up=pull_up, bounce_time=bounce_time)
20232023

20242024

0 commit comments

Comments
 (0)