物联网开发笔记(97)- Micropython ESP32开发之LM75 温度传感器I2C接口

本文介绍了如何使用ESP32开发板,配合MicroPython库与LM75温度传感器进行交互,包括传感器的驱动代码和示例,展示了读取温度并在ILI9341屏幕上显示的实现,还提到了将传感器的OS信号用于LED报警的功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、目的

        这一节我们学习如何使用乐鑫的ESP32开发板连接LM75 温度模块,温度相关的操作。

        在早前我们也介绍过其他温度传感器的模块的操作,这里我们来学习新的模块LM75 温度传感器,它精度高。

二、环境

        ESP32(固件:esp32-20220618-v1.19.1.bin) + Thonny(V4.0.1) + LM75 温度传感器模块 + ILI9341屏幕 + Win10 64位商业版

        ILI9341屏幕接线方法,以及屏幕驱动和相关字库,请看这个文章哈:

物联网开发笔记(91)- 使用Micropython开发ESP32开发板之通过串口SPI控制ILI9341 液晶屏显示文字_spi驱动ili9341_魔都飘雪的博客-优快云博客使用Micropython开发ESP32开发板之通过串口SPI控制ILI9341 液晶屏显示文字https://blog.youkuaiyun.com/zhusongziye/article/details/129350419?spm=1001.2014.3001.5501        LM75温度模块接线方法:

 

三、LM75温度传感器驱动

lm75a.py

"""
MicroPython LM75A Digital Temperature Sensor
https://github.com/mcauser/micropython-lm75a

MIT License
Copyright (c) 2019 Mike Causer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMIT
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

魔都飘雪

您的1毛奖励是我创作的源源动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值