Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clive520/37551d357099d951072e47dd16719113 to your computer and use it in GitHub Desktop.
Save clive520/37551d357099d951072e47dd16719113 to your computer and use it in GitHub Desktop.
DHT11溫溼度感測器_顯示距離於LCD_NodeMCU_ESP8266
/* Sketch was generated by motoblockly
Website: http://www.motoblockly.com
Author: www.motoduino.com
Date: Wed Jan 09 2019 19:12:47 GMT+0800
*/
//DHT11 接線方式{GND ==> GND VCC==>5V DATA==>D5(14) }
//LCD接線方式{GND ==> GND VCC==>5V SDA==>D2(04) SCL==>D1(05)}
#include <Wire.h>
#include <esp_LiquidCrystal_I2C.h>
#include "esp_DHTesp.h"
esp_LiquidCrystal_I2C mylcd(0x27, 16, 2);
long temperature;
long humidity;
DHTesp dht;
void setup()
{
mylcd.init();
mylcd.backlight();
pinMode(14, INPUT);
dht.setup(14);
temperature = 0;
humidity = 0;
}
void loop()
{
temperature = dht.getTemperature();
humidity = dht.getHumidity();
mylcd.clear();
mylcd.setCursor(0,0);
mylcd.print(String("Temperature:") + String(temperature) + String(" C"));
mylcd.setCursor(0,1);
mylcd.print(String("Humidity:") + String(humidity) + String(" %"));
delay(5000);
}
@JUN-YAO-LIU
Copy link

sorry i can't find the esp_LiquidCrystal_I2C.h of library ,how i can find this library
thanks~

@clive520
Copy link
Author

clive520 commented Jul 18, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment