Tak zkus:
(tep a vlh je uvedeneja jako h / t)
void setup() {
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); //0x3C popripade nahrad tim, jak je iniciilizovan ten tvuj
display.display(); // show splashscreen
delay(2000);
display.clearDisplay();
dht.begin();
delay(2000);
}
void loop() {
float h = dht.readHumidity();
float t = dht.readTemperature();
if (isnan(h) || isnan(t) {
delay(2000);
} else{
// prevod temp/hum floats do char arrays
char temp_buff[5]; char hum_buff[5];
char temp_disp_buff[11] = "Tmp:";
char hum_disp_buff[11] = "Hum:";
dtostrf(t,2,1,temp_buff);
strcat(temp_disp_buff,temp_buff);
dtostrf(h,2,1,hum_buff);
strcat(hum_disp_buff,hum_buff);
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println(temp_disp_buff);
display.println(hum_disp_buff);
display.display();
delay(2000);
}
}