import machine
import onewire
import ds18x20
import time
# The DS18B20 data pin is connected to GP4
dat = machine.Pin(6)
# Create the onewire object
ds = ds18x20.DS18X20(onewire.OneWire(dat))
while True:
    roms = ds.scan()
    print('Found DS devices: ', roms)
    
    ds.convert_temp()
    
    # delay is required to give sensor time to read the temperature
    time.sleep_ms(750)
    
    for rom in roms:
        print('Temperature: {0:.2f} C'.format(ds.read_temp(rom)))
    
    time.sleep(2)