from machine import Pin,I2C
from ssd1306 import SSD1306_I2C
import utime, framebuf

def ultra():
   trigger.low()
   utime.sleep_us(2)
   trigger.high()
   utime.sleep_us(5)
   trigger.low()
   while echo.value() == 0:
       signaloff = utime.ticks_us()
   while echo.value() == 1:
       signalon = utime.ticks_us()
       
   timepassed = signalon - signaloff
   distance1 = (timepassed * 0.0343) / 2
   distance = "{:.1f}".format(distance1)
   return str(distance)

i2c = I2C(0, scl = Pin(17), sda = Pin(16), freq = 400000)
oled = SSD1306_I2C(128,64,i2c)

trigger = Pin(27, Pin.OUT)
echo = Pin(26, Pin.IN)

    

while True:
    
    oled.text(ultra(),0,0)
    oled.show()
    oled.fill(0)
    utime.sleep(1)
$abcdeabcde151015202530fghijfghij
BOOTSELLED1239USBRaspberryPiPico©2020RP2-8020/21P64M15.00TTT