from machine import *
from utime import *

pir1 = Pin(7, Pin.IN, Pin.PULL_DOWN)  
pir2 = Pin(22, Pin.IN, Pin.PULL_DOWN)  
led = Pin(26, Pin.OUT) 
buzzer = Pin(17, Pin.OUT)  

def pir_handler(pin):
    sleep_ms(100)  
    if pin.value():
        if pin is pir1:
            print("Motion in bedroom!")
        elif pin is pir2:
            print("Motion in living room!")
        for i in range(50):  
            led.toggle()
            buzzer.toggle()
            sleep_ms(100)

pir1.irq(trigger=Pin.IRQ_RISING, handler=pir_handler)
pir2.irq(trigger=Pin.IRQ_RISING, handler=pir_handler)

while True:
    led.toggle()
    sleep(1)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT