作者: 51hei團團 時間: 2019-4-20 17:06
好東東 能分享源碼等資料嗎?作者: azi197417 時間: 2019-4-20 23:51
有資料共享嗎?作者: beardyan 時間: 2019-4-28 07:01
各位網友,我在某寶購買了sht30和sht31后,頁面會附上adafruit sht3xd材料的網址,其中的文件包就包含<adafruit sht3xd.h>,再在度娘上搜I2C_Lcd1602頭文件很方便,借鑒arduino+dht11的文章以及aruduino+I2C_Lcd1602 test等文章,修改一下就行。祝你們成功!有問題歡迎交流作者: beardyan 時間: 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
****************************************************/
#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);
} 作者: tigerzq 時間: 2019-4-30 20:38
這個傳感器就是個貴呀!作者: 那個人_H 時間: 2021-3-18 23:10
這個可以換成其他的I2C引腳嗎作者: beardyan 時間: 2022-8-10 15:49