from machine import Pin , PWM
import utime  
trig = Pin( 0 , Pin.OUT , value = 0 )
echo = Pin(1 , Pin.IN , value = 0 )
led = Pin(2,Pin.OUT)
buzzer = Pin(3,Pin.OUT )
son = PWM(buzzer)
son.freq(4000)
def ultrason():
    t = Toff = Ton = distance = 0
    trig.on()
    utime.sleep_us(10)
    trig.off()
    while echo.value() == 0 :
        Toff = utime.ticks_us()
    while echo.value() == 1 :
        Ton = utime.ticks_us()
    t  = (Ton - Toff ) / 2 
def bip():
    son.duty_u16(65000)
    time.sleep_ms(50)
    son.duty_u16(0)
while 1 :
    Pin(3).on()
    time.sleep_ms(0.5)
    Pin(3).off()
    bip()



  
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT