2017| 0
|
[问题求助] maix dock+18B20 长时间工作后就一直读4096 |
本帖最后由 DFBJMRK9gEd 于 2021-4-11 16:50 编辑 问题:工作半小时内没有问题,时间超出半小时后读值就卡在4095.73....了 就很迷惑... from fpioa_manager import * from modules import onewire from board import board_info import time fm.register(14, fm.fpioa.GPIOHS2, force=True) ds18b20=onewire(fm.fpioa.GPIOHS2) def get_temp(): ds18b20.reset() ds18b20.writebyte(0xcc) ds18b20.writebyte(0x44) ds18b20.reset() ds18b20.writebyte(0xcc) ds18b20.writebyte(0xbe) tplsb=ds18b20.readbyte() tpmsb=ds18b20.readbyte() s_tem = tpmsb<<8; s_tem = s_tem | tplsb; if( s_tem < 0 ): f_tem = (~s_tem+1) * 0.0625; else: f_tem = (s_tem * 0.0625); return f_tem while(True): print(get_temp()) |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed