from machine import Pin, ADC
from time import sleep_ms

rx = ADC(Pin(26, Pin.IN))
tx = Pin(0, Pin.OUT)

def probe():
    result = 0
    for i in range(10):
        tx.value(1)
        high = rx.read_u16()
        sleep_ms(50)
        tx.value(0)
        low = rx.read_u16()
        result = result + (high - low)
    return result

while True:
    print(probe())
