Duncan Birdsall
Published © GPL3+

Temperature And Humidity Notifier

It is a notifier with temperature and humidity sensor in it. The LED screen will show the temperature and humidity at present.

AdvancedShowcase (no instructions)10 hours933
Temperature And Humidity Notifier

Things used in this project

Story

Read more

Code

Untitled file

C/C++
#include <Adafruit_DHT.h>
#include "application.h"
#include "LiquidCrystal/LiquidCrystal.h"
#include "Adafruit_DHT/Adafruit_DHT.h"
#define DHTPIN 2
#define DHTTYPE DHT11
int HT = 1;
DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal lcd(D0, D1, A2, D3, D4, D5);
void setup() {
  lcd.begin(16,2);
  dht.begin();
  Particle.function("T-H", ReadHT);
  lcd.print("Temp:          F");
}
void loop() {
    if (HT == 1) {
    lcd.setCursor(10,0);
    lcd.print(dht.getTempFarenheit());
    }
    if (HT == 0) {
    lcd.setCursor(10,0);
    lcd.print(dht.getHumidity());
    }
}
int ReadHT(String command) {
    if (command=="Temperature") {
        lcd.setCursor(0,0);
        lcd.print("Temp:          F");
        HT = 1;
    }else
    if (command=="Humidity") {
        lcd.setCursor(0,0);
        lcd.print("Humidity:      %");
        HT = 0;
    }else
    {
        return -1;
    }
}

Credits

Duncan Birdsall

Duncan Birdsall

0 projects • 0 followers

Comments