#https://microcontrollerslab.com/pir-motion-sensor-raspberry-pi-pico/
from machine import Pin
import utime
# vcc - 3v3
# gnd
# out = GP0
# Pin(Pin_number,
# pin_mode (IN, OUT, OPEN_DRAIN),
# Internal resistor pull value(PULL_UP OR PULL_DOWN),
# value (1 0r 0))
#
IR = Pin(0, Pin.IN)
#utime.sleep(3)
c = 0
while True:
motion = IR.value()
#print(motion)
print(motion)
if motion == 1:
print("motion detected")
#utime.sleep(1)
utime.sleep(0.5)
c = c+1
# volume of buzzer
else:
print("NO")
utime.sleep(0.5)
if c==3:
break
print(c)