找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 5145|回复: 9
打印 上一主题 下一主题
收起左侧

arduino nano+I2C LCD1602+SHT3XD温湿度显示器

[复制链接]
跳转到指定楼层
楼主
忙碌了一周,终于做成了基于arduino nano和I2C模式下,以sht3xd为传感器的温湿度计。头文件是“adafruit sht3xd.h"和”LiquidCrystal_lCD1602_I2C.h". 两个器件都用的是I2C模式,都用到了nano的A4、A5脚,所以各自地址要清楚。sht3xd的是0x44, lcd1602的是0x3F(也有0x27/0x20的)。常用的玩意,就不上程序了。可借鉴Dht11的程序,祝大家成功!




评分

参与人数 2黑币 +60 收起 理由
azi197417 + 10 赞一个!
admin + 50 共享资料的黑币奖励!

查看全部评分

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:328014 发表于 2019-4-20 17:06 | 只看该作者
好东东 能分享源码等资料吗?
回复

使用道具 举报

板凳
ID:452731 发表于 2019-4-20 23:51 | 只看该作者
有资料共享吗?
回复

使用道具 举报

地板
ID:274121 发表于 2019-4-28 07:01 | 只看该作者
各位网友,我在某宝购买了sht30和sht31后,页面会附上adafruit sht3xd材料的网址,其中的文件包就包含<adafruit sht3xd.h>,再在度娘上搜I2C_Lcd1602头文件很方便,借鉴arduino+dht11的文章以及aruduino+I2C_Lcd1602 test等文章,修改一下就行。祝你们成功!有问题欢迎交流
回复

使用道具 举报

5#
ID:274121 发表于 2019-4-29 21:00 | 只看该作者
请参考/***************************************************
  This is an example for the SHT31-D Humidity & Temp Sensor

  Designed specifically to work with the SHT31-D sensor from Adafruit

  These sensors use I2C to communicate, 2 pins are required to  
  interface
  Hardware connections for Arduino Nano:
  VDD to 3.3V DC
  SDA to A4
  SCL to A5
  GND to common groud
****************************************************/

#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
#include "LiquidCrystal_I2C.h"

Adafruit_SHT31 sht31 = Adafruit_SHT31();

#if defined(ARDUINO_ARCH_SAMD)
// for Zero, output on USB Serial console, remove line below if using programming port to program the Zero!
   #define Serial SerialUSB
#endif

void setup() {
//#ifndef ESP8266
// while (!Serial);     // will pause Zero, Leonardo, etc until serial console opens
//#endif
  Serial.begin(9600);
  Serial.println("SHT31 test");
  if (! sht31.begin(0x44)) {   // Set to 0x45 for alternate i2c addr
    Serial.println("Couldn't find SHT31");
    while (1)
    delay(1);
  }
}


void loop() {
  float t = sht31.readTemperature();
  float h = sht31.readHumidity();

  if (! isnan(t)) {  // check if 'is not a number'
    Serial.print("Temp *C = "); Serial.println(t);
  } else {
    Serial.println("Failed to read temperature");
  }
  
  if (! isnan(h)) {  // check if 'is not a number'
    Serial.print("Hum. % = "); Serial.println(h);
  } else {
    Serial.println("Failed to read humidity");
  }
  Serial.println();
  delay(5000);
}
回复

使用道具 举报

6#
ID:471632 发表于 2019-4-30 20:38 | 只看该作者
这个传感器就是个贵呀!
回复

使用道具 举报

7#
ID:521698 发表于 2021-3-18 23:10 | 只看该作者
这个可以换成其他的I2C引脚吗
回复

使用道具 举报

8#
ID:274121 发表于 2022-8-10 15:49 | 只看该作者
51hei团团 发表于 2019-4-20 17:06
好东东 能分享源码等资料吗?

后悔没有存代码,现在我也在找这类材料
回复

使用道具 举报

9#
ID:274121 发表于 2022-8-10 15:52 | 只看该作者
那个人_H 发表于 2021-3-18 23:10
这个可以换成其他的I2C引脚吗

A4.A5是IIC专用SCL和SDA
回复

使用道具 举报

10#
ID:138707 发表于 2023-7-29 17:59 | 只看该作者
非常感谢,很需要这代码
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表