Dear all, this is my first topic.
I have a problem with RTC Widget, it doesn’t run on my WeMos D1.
With the follow code I’m able to display time and data on LCD display Widget (I used V50 and V51 as for virtual pin), but I’m not able to watch time on RTC Widget (it appear only a clock icon).
Could you please tell me some tip?
Thanks
Lorenzo
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <TimeLib.h>
#include <WidgetRTC.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "02e1400d32XXXXXXXXXXXb4d1";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "XXXXXXXwifi";
char pass[] = "XXXXXXXXX";
BlynkTimer timer;
WidgetRTC rtc;
// Digital clock display of the time
void clockDisplay()
{
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details
String currentTime = String(hour()) + ":" + minute() + ":" + second();
String currentDate = String(day()) + " " + month() + " " + year();
Serial.print("Current time: ");
Serial.print(currentTime);
Serial.print(" ");
Serial.print(currentDate);
Serial.println();
// Send time to the App
Blynk.virtualWrite(V50, currentTime);
// Send date to the App
Blynk.virtualWrite(V51, currentDate);
}
void setup()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// Begin synchronizing time
rtc.begin();
// Display digital clock every 10 seconds
timer.setInterval(10000L, clockDisplay);
}
void loop()
{
Blynk.run();
timer.run();
}