简体   繁体   English

树莓派与ds18b20接口

[英]raspberry pi interfacing with ds18b20

I have been working on a home automation project using raspberry pi. 我一直在使用树莓派进行家庭自动化项目。 I need to import module W1thermsensor for communicating with ds18b20. 我需要导入模块W1thermsensords18b20通信。 Our modules are currently written in python 2.7 and ds18b20 is written in python 3.3. 目前,我们的模块是用python 2.7编写的,而ds18b20是用python 3.3编写的。

Is there an alternative for ds18b20 in python 2.7? python 2.7中是否有ds18b20的替代品?

Porting code from python 2.7 to 3.3 is not an option due to deadlines. 由于截止日期,无法将代码从python 2.7移植到3.3。

From official documentation : 根据官方文件

For Python3: sudo apt-get install python3-w1thermsensor 对于Python3: sudo apt-get install python3-w1thermsensor

For Python2: sudo apt-get install python-w1thermsensor 对于Python2: sudo apt-get install python-w1thermsensor

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM