from microbit import *
from machine import time_pulse_us
pin12.read_digital()

pin16.write_digital(1)
sleep(0.010)
pin16.write_digital(0)
t = time_pulse_us(pin12, 1)
h=round((340*t*1e-6/2)*100,1)
print("Hauteur:",h,"cm")
V=round(24.8*15*(16.6-h)/1000,2)
print ("le volume de fuel restant est :", V, "L")
UV=round(V*(((0.2/t)**2+(4/340)**2)**0.5),2)
print("l'incertitude sur le volume de fuel restant :",UV,"L")
