import tm1637
from machine import Pin,ADC
from machine import Pin,time_pulse_us
from time import sleep,sleep_us
from math import log

Beta = 3950
sensor=ADC(Pin(26))
tm = tm1637.TM1637(clk=Pin(4), dio=Pin(5))
echo = Pin(27, Pin.IN)
trigger = Pin(28, Pin.OUT)

while 1:
    val=sensor.read_u16()
    voltage=val/65535*3.3
    celcius = 1/(log(1/(65535.00/val-1))/Beta+1.0/298.15)-273.15;
    print("temperature",celcius,"^C")

    i=int(celcius)
    tm.number(i)
    sleep(0.4)
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT
4-Digit Display