from machine import Pin
from time import sleep
import time
pir1 = Pin(16, Pin.IN)
pir2 = Pin(18, Pin.IN)
led = Pin(27, Pin.OUT)
buzzer_pin = machine.Pin(1, machine.Pin.OUT)
while True:
if pir1.value() == 1:
print(f"PIR1 value: {pir1.value()} Motion detected!")
led.on()
time.sleep(2)
led.off()
else:
print(f"PIR1 value: {pir1.value()} No motion detected")
if pir2.value() == 1:
print(f"PIR2 value: {pir2.value()} Motion detected!")
buzzer_pin.on()
time.sleep(1)
buzzer_pin.off()
else:
print(f"PIR2 value: {pir2.value()} No motion detected")
print("\n")
print("----------------------------------")
print("\n")
sleep(1)