Hallo! Having trouble with motion sensor code.
A motion sensor detects movement and lights a LED, when movement stops the LED goes off.
Thats OK and works.
When movement is detected I wan´t to play a wav-file and print a statement.
When movement stops I wan´t to play a another wav-file and print a statement.
I tried to do while True- loops, and tried IF -loops but it does not work.
Any ideas to put me in the right direction?
from gpiozero import MotionSensor, LED
from signal import pause
from playsound import playsound
pir = MotionSensor(17)
led = LED(16)
pir.when_motion = led.on
pir.when_no_motion = led.off