[Solved] ESP8266 RTC Widget not working

Hi,

I’m using an ESP8266 for a LED controlling / light alarm clock project. The ESP is just used as a bridge to connect the Blynk app to an Atmega88A via UART. The Atmega is doing all the controlling.
I’m trying to use the RTC widget, which should print the current time and date over the UART.

Unfortunately, the RTC widget isn’t working. I’ve used the example code in order to test the RTC widget, but as you can see in the screenshot, the time starts at 00:00:00, counting up every second.
I assume, that the RTC widget isn’t syncing the time to the ESP8266.

How can i fix this problem?

Of course I’ve read some threads concerning this problem, but I haven’t found a solution at all.

Thank’s in advance.

Code:

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <TimeLib.h>
#include <WidgetRTC.h>


// PWM-Values for LED dimming
word v0 = 0;
word v1 = 0;
word v2 = 0;
word v3 = 0; 
word v4 = 0;
word v5 = 0; 
word v0_old = 0;
word v1_old = 0;
word v2_old = 0;
word v3_old = 0;
word v4_old = 0;
word v5_old = 0;

String send_bfr = ""; 

char auth[] = "6134e06b6c0842b3831545e5355*****";

char ssid[] = "TP-LINK_5CE4";
char pass[] = "********";

SimpleTimer timer;

WidgetRTC rtc;

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

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  rtc.begin();

  timer.setInterval(1000L, clockDisplay);
}

// Read Fader/zeRGBa Widgets
BLYNK_WRITE(V0){ 
   v0 = param.asInt() ;
}
BLYNK_WRITE(V1){ 
   v1 = param.asInt() ;
}
BLYNK_WRITE(V2){ 
   v2 = param.asInt() ;
}
BLYNK_WRITE(V3){ 
   v3 = param.asInt();
}
BLYNK_WRITE(V4){ 
   v4 = param.asInt();
}

void loop()
{

  v0_old = v0;
  v1_old = v1;
  v2_old = v2;
  v3_old = v3;
  v4_old = v4;

  Blynk.run();
  timer.run();

if (v0 != v0_old | v1 != v1_old | v2 != v2_old | v3 != v3_old | v4 != v4_old){ //send only, if values have changed
  send_bfr= String(v0+100) + String(v1+100) + String(v2+100) + String(v3+100) + String(v4+100) + "1";
  Serial.print(send_bfr +'\n'); 
}

    //delay (500);

}

Move to 0.4.4 and latest app version.

Edit: as covered by the Blynk Announcements section of this site.

Hi Costas,

thank you very much indeed! It finally works. :wink: