from machine import Pin, time_pulse_us
from time import sleep
Dat= Pin(0, Pin.OUT)
def medir_Pulso():
medida1= time_pulse_us(Dat, 1)
medida0= time_pulse_us(Dat, 0)
print("tempo ligado:", medida1)
print("tempo desligado:", medida0)
sleep(1)
while True:
medir_Pulso()