找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索

arduino nano+I2C LCD1602+SHT3XD溫濕度顯示器

查看數(shù): 6315 | 評(píng)論數(shù): 9 | 收藏 0
關(guān)燈 | 提示:支持鍵盤翻頁(yè)<-左 右->
    組圖打開中,請(qǐng)稍候......
發(fā)布時(shí)間: 2019-4-20 15:02

正文摘要:

忙碌了一周,終于做成了基于arduino nano和I2C模式下,以sht3xd為傳感器的溫濕度計(jì)。頭文件是“adafruit sht3xd.h"和”LiquidCrystal_lCD1602_I2C.h". 兩個(gè)器件都用的是I2C模式,都用到了nano的A4、A5腳,所以各 ...

回復(fù)

ID:138707 發(fā)表于 2023-7-29 17:59
非常感謝,很需要這代碼
ID:274121 發(fā)表于 2022-8-10 15:52
那個(gè)人_H 發(fā)表于 2021-3-18 23:10
這個(gè)可以換成其他的I2C引腳嗎

A4.A5是IIC專用SCL和SDA
ID:274121 發(fā)表于 2022-8-10 15:49
51hei團(tuán)團(tuán) 發(fā)表于 2019-4-20 17:06
好東東 能分享源碼等資料嗎?

后悔沒有存代碼,現(xiàn)在我也在找這類材料
ID:521698 發(fā)表于 2021-3-18 23:10
這個(gè)可以換成其他的I2C引腳嗎
ID:471632 發(fā)表于 2019-4-30 20:38
這個(gè)傳感器就是個(gè)貴呀!
ID:274121 發(fā)表于 2019-4-29 21:00
請(qǐng)參考/***************************************************
  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);
}
ID:274121 發(fā)表于 2019-4-28 07:01
各位網(wǎng)友,我在某寶購(gòu)買了sht30和sht31后,頁(yè)面會(huì)附上adafruit sht3xd材料的網(wǎng)址,其中的文件包就包含<adafruit sht3xd.h>,再在度娘上搜I2C_Lcd1602頭文件很方便,借鑒arduino+dht11的文章以及aruduino+I2C_Lcd1602 test等文章,修改一下就行。祝你們成功!有問題歡迎交流
ID:452731 發(fā)表于 2019-4-20 23:51
有資料共享嗎?
ID:328014 發(fā)表于 2019-4-20 17:06
好東東 能分享源碼等資料嗎?

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表