Hi All
Complete and utter newbie here so please be gentle. I am following Paul Whorter's series on Utube and have completed the DT11 sensor project. I added the LCD and all was good but i wanted to add a RTC. I had a spare 20,4 LCD and wanted to add the time and date and just keep Humidity and temp in deg C. I got all this working but i am having a problem with the seconds in the time. It will start to count normally but when it gets to 50 seconds, will randomly start counting BUT keeps the correct hours and minutes.
#include <LiquidCrystal.h>
#include <virtuabotixRTC.h>
#include "DHT.h"
#define Type DHT11
virtuabotixRTC myRTC(3, 4, 5);
int rs = 7;
int en = 8;
int d4 = 9;
int d5 = 10;
int d6 = 11;
int d7 = 12;
LiquidCrystal lcd (rs, en, d4, d5, d6, d7);
int sensePin = 2;
DHT HT(sensePin, Type);
float humidity;
float tempC;
float tempF;
int setTime = 500;
void setup() {
Serial.begin(9600);
HT.begin();
delay(setTime);
lcd.begin(20, 4);
}
void loop() {
myRTC.updateTime();
lcd.setCursor(0, 0);
lcd.print(myRTC.dayofmonth);
lcd.print("/");
lcd.print(myRTC.month);
lcd.print("/");
lcd.print(myRTC.year);
lcd.print(" ");
lcd.print(myRTC.hours);
lcd.print(":");
lcd.print(myRTC.minutes);
lcd.print(":");
lcd.print(myRTC.seconds);
delay(1000);
humidity = HT.readHumidity();
tempC = HT.readTemperature();
tempF = HT.readTemperature(true);
lcd.setCursor(0, 1);
lcd.print("Humidity= ");
lcd.print(humidity);
lcd.print(" %");
lcd.setCursor(0, 2);
lcd.print("Temp C= ");
lcd.print(tempC);
Serial.print(" Humidity ");
Serial.print(humidity);
Serial.print(" Temperature C ");
Serial.print(tempC);
Serial.print(" C ");
Serial.print(tempF);
Serial.println(" F ");
}
I believe the error is where i have combined the 2 sets of code but i don't have the experience to de-bug yet.
Please just point me in the right direction and let me try to fix it myself.
Many Thanks
Ian