Skip to content

Instantly share code, notes, and snippets.

@Xzenia
Created March 17, 2019 09:48
Show Gist options
  • Save Xzenia/657314bf50df6c4caec4292d3f42662c to your computer and use it in GitHub Desktop.
Save Xzenia/657314bf50df6c4caec4292d3f42662c to your computer and use it in GitHub Desktop.
Temperature Sensor code
#include <dht.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,2,1,0,4,5,6,7,3,POSITIVE);
dht DHT;
#define DHT11_PIN 2
void setup(){
lcd.begin(16,2);
lcd.clear();
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
lcd.print(String("Temp: ") + String(DHT.temperature));
lcd.setCursor(0,2);
lcd.print(String("Humidity: ") + String(DHT.humidity));
delay(2000);
lcd.clear();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment