#define F_CPU 16000000UL
#include <util/delay.h>
#include <stdio.h>
#include "liblcd.h"
#include "libdht.h"
int main() {
LCD_Init();
LCD_PrintXY(0, 0, "DHT11/22");
_delay_ms(500);
double temp = 0;
double umid = 0;
while(1) {
if(DHT_Ler(&temp, &umid) != -1) {
LCD_Clear();
LCD_PrintXY(0, 0, "Temp: ");
char str_valor[10];
dtostrf(temp, 4, 1, str_valor);
LCD_Print(str_valor);
sprintf(str_valor, "%c", 0b11011111);
LCD_Print(str_valor);
LCD_Print("C");
LCD_PrintXY(0, 1, "Umid: ");
dtostrf(umid, 4, 1, str_valor);
LCD_Print(str_valor);
LCD_Print("%");
}
else {
LCD_Clear();
LCD_PrintXY(0, 0, "DHT: Erro!");
}
_delay_ms(1000);
}
}