Having an issue with writing data to the LCD screen for a dual sensor weather station.
The Humidity data (h) for the "Hum-in" writes as "3333333333.00%" its reading the humidity fine, but for whatever reason shows the above on the LCD screen, my setup has 2 LCDs and it doesn't matter which LCD i write to it displays that. The problem persists even if i swap (h) and (t), so its an issue with writing to the LCD, but i can't figure out the issue.
The Issue is with My_LCD1
Any help would be greatly appreciated.
#include <LiquidCrystal.h>
#include <Adafruit_Sensor.h>
#include "DHT.h"
LiquidCrystal My_LCD1(1, 0, 3, 4, 5 , 6);
LiquidCrystal My_LCD2(2, 0, 7, 8, 9 , 10);
#define DHT1PIN 11
#define DHT2PIN 12
#define DHT1TYPE DHT11
#define DHT2TYPE DHT11
DHT dht_1(DHT1PIN, DHT1TYPE);
DHT dht_2(DHT2PIN, DHT2TYPE);
void setup() {
My_LCD1.begin(16, 2);
My_LCD2.begin(16, 2);
dht_1.begin();
dht_2.begin();
}
void loop() {
delay(2000);
float h = dht_1.readHumidity();
// Read temperature as Celsius (the default)
float t = dht_1.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht_1.readTemperature(false);
float h1 = dht_2.readHumidity();
// Read temperature as Celsius (the default)
float t1 = dht_2.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f1 = dht_2.readTemperature(false);
My_LCD1.setCursor(0, 0);
My_LCD1.print("Hum-in: ");
My_LCD1.print(h);
My_LCD1.print("%");
My_LCD1.setCursor(0, 1);
My_LCD1.print("Temp-in: ");
My_LCD1.print(t);
My_LCD1.print((char)223);
My_LCD1.print("C");
My_LCD2.setCursor(0, 0);
My_LCD2.print("Hum-out: ");
My_LCD2.print(h1);
My_LCD2.print("%");
My_LCD2.setCursor(0, 1);
My_LCD2.print("Temp-out: ");
My_LCD2.print(t1);
My_LCD2.print((char)223);
My_LCD2.print("C");
}
How do you know this??
It's not what it prints and I see no Serial prints..
Sometimes those sensor return a nan, Not A Number..
use isnan(t) to check and return if it is, to read again..
or maybe your screens are cursed, gremlins..
~good luck.. ~q
Have you tried separate EN connections? The examples I can find for multiple displays show common connections for everything except EN, the exact opposite of how you have it wired.