I have 16x2 lcd and I am trying to print temperature on it. The sensor is dht11. I tried everything but it looks like there is some problem with parsing the temeprature. Problem isnt in the sensor it prints on serial the temperature correctly. Here is the code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(0, 1, 8, 9, 10, 11);
#include "DHT.h"
// nastavení čísla pinu s připojeným DHT senzorem
#define pinDHT 5
// odkomentování správného typu čidla
#define typDHT11 DHT11
DHT mojeDHT(pinDHT, typDHT11);
void setup() {
Serial.begin(9600);
mojeDHT.begin();
lcd.begin(16, 2);
lcd.setCursor(0,0);
}
void loop() {
float tep = mojeDHT.readTemperature();
float vlh = mojeDHT.readHumidity();
if (isnan(tep) || isnan(vlh)) {
Serial.println("Chyba při čtení z DHT senzoru!");
} else {
Serial.println(tep);
lcd.println(int(tep));
}
// pauza pro přehlednější výpis
delay(2000);
}
I have 16x2 lcd and I am trying to print temperature on it. The sensor is dht11. I tried everything but it looks like there is some problem with parsing the temeprature. Problem isnt in the sensor it prints on serial the temperature correctly. Here is the code:
#include <LiquidCrystal.h>
LiquidCrystal lcd(0, 1, 8, 9, 10, 11); #include “DHT.h”
// nastavení čísla pinu s připojeným DHT senzorem #define pinDHT 5
When you print to the LCD the cursor moves to the end of the prined characters. If you want to always start the print at cursor position (0,0) you need to move the cursor there each time before you print with
I have arduino uno and I am using lcd without potenciometer. Again, I dont have any problem with lcd or dht11 itself only with printing the temperature