#include <LiquidCrystal.h>
#include "DHTesp.h"

const int DHT_PIN = 15;

DHTesp dhtSensor;

LiquidCrystal lcd(14, 27, 26, 25, 33, 32);

uint8_t degsym[8] = {
  0b00110,
  0b01001,
  0b01001,
  0b00110,
  0b00000,
  0b00000,
  0b00000,
  0b00000,
};

uint8_t arrow[8] = {
  0b00000,
  0b00100,
  0b00110,
  0b11111,
  0b00110,
  0b00100,
  0b00000,
  0b00000
};

void setup() {
  lcd.begin(20, 4);
  lcd.createChar(1, degsym);
  lcd.createChar(2, arrow);
  lcd.setCursor(0, 0);
  lcd.write("Temperature Control");
  lcd.setCursor(2, 1);
  lcd.write ("SENSOR");
  lcd.setCursor(11, 1);
  lcd.write ("TARGET");
  lcd.setCursor(0, 2);
  lcd.write ("A");
  lcd.setCursor(9, 2);
  lcd.write ("\x02");
  lcd.setCursor(0, 3);
  lcd.write ("B");
  lcd.setCursor(9, 3);
  lcd.write ("\x02");
  lcd.setCursor(18, 2);
  lcd.write ("C\x01");
  lcd.setCursor(18, 3);
  lcd.write ("C\x01");
  dhtSensor.setup(DHT_PIN, DHTesp::DHT22);
}

void loop() {
  TempAndHumidity  data = dhtSensor.getTempAndHumidity();
  lcd.setCursor(3, 2);
  lcd.print(String(data.temperature, 2));
}