mlx90614 python
时间: 2023-08-27 12:21:06 浏览: 184
mlx90614的驱动程序
要在Python中使用MLX90614温度传感器,你可以按照以下步骤进行操作:
1. 首先,你需要安装mlx90614库。你可以使用pip来安装它。在终端中执行以下命令: [2]
```
pip3 install adafruit-circuitpython-mlx90614
```
2. 然后,你需要导入库并初始化MLX90614传感器。你可以参考下面的代码: [3]
```python
import board
import adafruit_mlx90614
i2c = board.I2C()
mlx = adafruit_mlx90614.MLX90614(i2c)
```
3. 现在你可以使用MLX90614传感器来读取温度了。你可以使用`object_temperature`方法来读取物体的温度。下面是一个读取体温的例子: [3]
```python
def readTemp():
try:
temp = mlx.object_temperature
return round(temp, 1)
except:
print('读取体温失败!')
```
通过调用`readTemp()`函数,你就可以获取MLX90614传感器测量到的人体温度了。请注意,这只是一个简单的示例,你可能需要根据你的具体需求对代码进行适当的修改。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [树莓派4B通过Python读取MLX90614温度](https://blog.csdn.net/Hao_ge_666/article/details/117170782)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [树莓派 --- 疫情防控检测一体化设备](https://blog.csdn.net/YINZHE__/article/details/121989578)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文