RTC Widget does not run

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();
}

That’s how it was designed.

Thanks Costas, but is possible to show hour and minute instead of the clock icon?

You have done it with V50 and V51.

You could format your posted code :wink:

Blynk - FTFC

The RTC Widget is like a software version of an RTC module… it is NOT a clock face :slight_smile: it is a placeholder in the App that indicates the presence of that server based timekeeping function, and is used for setting the required timezone of the users phone (when traveling).

As per the code you pasted here, the actual time/date format is coded in your sketch and send back to Display Widgets, etc, in digital format only… there is NO analog format for the App.

3 Likes

@lollo71 as shown and stated above… backticks, not commas.

1 Like

Thank you Gunner …now is ok. Now I also understand how the RTC Widget works! You are a great Community, Blynk, in my opinion, is a revolution! :muscle:

3 Likes