temperature.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:micropython 作者: stlk 项目源码 文件源码
def read_temp():
    # the device is on GPIO12
    dat = machine.Pin(5)

    # create the onewire object
    ds = ds18x20.DS18X20(onewire.OneWire(dat))

    # scan for devices on the bus
    roms = ds.scan()
    # print('found devices:', roms)
    # print('temperature:', end=' ')
    ds.convert_temp()
    time.sleep_ms(750)
    temp = ds.read_temp(roms[0])
    # print(temp)
    return temp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号