Hello everybody,
I have a problem converting the time from rtc to s. For me he always spits only e.g. at 21:51 = 13,124. Although it would have to be 3600 * 21 + 60 * 51 = 78.660.
What did I do wrong?
#define BLYNK_PRINT Serial
#define EspSerial Serial
#define BLYNK_PRINT Serial
#define ESP8266_BAUD 115200
#include <SPI.h>
#include <ESP8266_Lib.h>
#include <BlynkSimpleShieldEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
char auth[] = "---";
char ssid[] = "---";
char pass[] = "---";
BlynkTimer timer;
WidgetRTC rtc;
ESP8266 wifi(&EspSerial);
String currentTime;
String currentDate;
long Time;
void clockDisplay()
{
Time = 3600*hour() + 60* minute();
currentTime = String(hour()) + ":" + minute() + ":" + second();
currentDate = String(day()) + " " + month() + " " + year();
Serial.print("Current time: ");
Serial.print(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println();
Serial.print(Time);
Serial.println();
// Send time to the App
}
BLYNK_READ(V4){
Blynk.virtualWrite(V4, hour());
}
BLYNK_READ(V5){
Blynk.virtualWrite(V5, minute());
}
BLYNK_READ(V6){
Blynk.virtualWrite(V6, Time);
}
BLYNK_CONNECTED() {
rtc.begin();
}
void setup()
{
// Debug console
Serial.begin(115200);
EspSerial.begin(ESP8266_BAUD);
delay(10);
Blynk.begin(auth, wifi, ssid, pass);
setSyncInterval(30);
timer.setInterval(10000L, clockDisplay);
}
void loop()
{
Blynk.run();
timer.run();
}