/*****************************
Pengujian LCD I2C

******************************/

#include "LiquidCrystal_I2C.h"
LiquidCrystal_I2C lcd(0x27, 16, 2);

void about();

float T = 0.0;
char str[10];
int htr;

void setup() {
  lcd.init();
  lcd.backlight();

  //about();
  lcd.setCursor(0,0);
  lcd.print("S=xx.xC");
  lcd.setCursor(0,1);
  lcd.print("A=xx.xC H=xxx%");
}
void loop(){
  T += 0.1;
  htr += 10;
  if(htr>100)
    htr = 0;

  lcd.setCursor(2,0);
  dtostrf(T,4,1,str);
  lcd.print(str);

  lcd.setCursor(2,1);
  dtostrf(100-T,4,1,str);
  lcd.print(str);

  lcd.setCursor(10,1);
  sprintf(str,"%3d", htr);
  lcd.print(str);
  
  delay(500);
}

void about(){
  lcd.setCursor(0,0);
  lcd.print("Kontrol Suhu");
  lcd.setCursor(0,1);
  lcd.print("SKD-2A 2023");
  delay(4000);
  lcd.clear();
}