Hello everyone , I’m trying the new RTC widget on cloud server , I tried the example RTC , modifying it to work with the esp8266 as shield in hardware serial . The sketch seems to work correctly only that returns me the date and time 1/1/1970 0 : 0 : 0 , after ten seconds to change time in 0 : 0 : 10 , a sign that the rtc not ’ locked .
In practice it seems that the date and time are not synchronized , and this ’ the scketch I used an Arduino Mega :
/**************************************************************
* Blynk is a platform with iOS and Android apps to control
* Arduino, Raspberry Pi and the likes over the Internet.
* You can easily build graphic interfaces for all your
* projects by simply dragging and dropping widgets.
*
* Downloads, docs, tutorials: http://www.blynk.cc
* Blynk community: http://community.blynk.cc
* Social networks: http://www.fb.com/blynkapp
* http://twitter.com/blynk_app
*
* Blynk library is licensed under MIT license
* This example code is in public domain.
*
**************************************************************
* Blynk can provide your device with time data, like an RTC.
* Please note that the accuracy of this method is up to several seconds.
*
* App dashboard setup:
* RTC widget on V5
*
* WARNING :
* For this example you'll need SimpleTimer library:
* https://github.com/jfturcot/SimpleTimer
*
* And also this Time keeping library:
* https://github.com/PaulStoffregen/Time
*
* This code is based on an example from the Time library:
* https://github.com/PaulStoffregen/Time/blob/master/examples/TimeSerial/TimeSerial.ino
*
**************************************************************/
//#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <SimpleTimer.h>
#include <Time.h>
#include <WidgetRTC.h>
#define EspSerial Serial1
ESP8266 wifi(EspSerial);
SimpleTimer timer;
WidgetRTC rtc;
BLYNK_ATTACH_WIDGET(rtc, V5)
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "f35e0b7333424061bfeb2b2d5af25e7a";
void setup()
{
Serial.begin(9600);
delay(10);
// Set ESP8266 baud rate
EspSerial.begin(115200);
delay(10);
Blynk.begin(auth, wifi, "Indianet", "pimapima");
Serial.println(dentrowhile
while (Blynk.connect() == false) {
// Wait until connected
}
// Display digital clock every 10 seconds
timer.setInterval(10000L, clockDisplay);
}
// Digital clock display of the time
void clockDisplay()
{
// You can call hour(), minute(), ... at any time
// Please see Time library examples for details
BLYNK_LOG("Current time: %02d:%02d:%02d %02d %02d %d",
hour(), minute(), second(),
day(), month(), year());
Serial.print("|");
Serial.print(hour());
Serial.print(minute());
Serial.println(second());
Serial.print(day());
Serial.print(month());
Serial.println(year());
}
void loop()
{
Blynk.run();
timer.run();
}
and this the results:
|0026
111970
|0036
111970
|0046
111970
|0056
111970
|016
111970
|0116
111970
|0126
111970
|0136
111970
|0146
111970
|0156
111970
|026
111970
|0216
111970
|0226
111970
|0236
111970
Am I wrong something?