@Dmitriy if you look at the Serial Monitor and associated sketch at the start of this thread you will see that we connect, disconnect and reconnect several times over a 30 second interval. This is not the way the actual system works but it is more to highlight our problem. So the first connection gives RTC data but none of the subsequent connections.
Thinking about this it is probably the 5 / 10 minute standard interval that is set with RTC. We expect our systems to sleep for 10 minutes (maybe 5) so it might not be a problem, but when we are testing we set the sleep period very short (30 seconds sometimes) as we don’t want to wait 5 or 10 minutes to see if our latest sketch changes are working.
On second thoughts this can’t be the problem as the 1000+ connections with the standard RTC sketch we made the night before last were at 20 second intervals (with a short deepsleep included within the 20 seconds).
A sample of the 8000+ lines of Serial Monitor data for the 1000+ succesful RTC requests are shown below:
[15661] Current time: 22:42:39 29 03 2016
Connecting to GargoyleTest
[1244] Connected to WiFi
[1244] My IP: 192.168.10.226
[1245] Blynk v0.3.4
[5001] Connecting to blynk-cloud.com:8442
[5311] Ready (ping: 1ms).
[5623] Time sync: OK
[15905] Current time: 22:43:05 29 03 2016
Connecting to GargoyleTest
[1252] Connected to WiFi
[1252] My IP: 192.168.10.226
[1252] Blynk v0.3.4
[5001] Connecting to blynk-cloud.com:8442
[5344] Ready (ping: 3ms).
[5680] Time sync: OK
[15680] Current time: 22:43:32 29 03 2016
Connecting to GargoyleTest
[1250] Connected to WiFi
[1250] My IP: 192.168.10.226
[1250] Blynk v0.3.4
[5001] Connecting to blynk-cloud.com:8442
[5309] Ready (ping: 0ms).
[5638] Time sync: OK
[15638] Current time: 22:43:59 29 03 2016
Connecting to GargoyleTest
[1247] Connected to WiFi
[1247] My IP: 192.168.10.226
[1247] Blynk v0.3.4
[5001] Connecting to blynk-cloud.com:8442
[5385] Ready (ping: 1ms).
[5743] Time sync: OK
[15742] Current time: 22:44:32 29 03 2016
I cut and paste your code but I am unable to get real time. See results
347644] Connecting to blynk-cloud.com:8442
[348270] Ready (ping: 1ms).
Should be connected to Blynk now
[349885] Current time: 00:05:49 01 01 1970
[349886] Disconnected
[357644] Connecting to blynk-cloud.com:8442
[358308] Ready (ping: 1ms).
Should be connected to Blynk now
[359920] Current time: 00:05:59 01 01 1970
[359921] Disconnected
[367644] Connecting to blynk-cloud.com:8442
[368238] Ready (ping: 0ms).
Should be connected to Blynk now
[369814] Current time: 00:06:09 01 01 1970
[369815] Disconnected
I did use the example widget code provided and got the same results. I did get some notification on a few odd occasions that I was sync’ed but this is no longer the case and at the time I was not probing the RTC time so I have no idea that it was working.
What I do find strange is that the Timer Widget works at the prescribed time and works beautifully. I don’t know where it is getting the real time from?
OK I ran the exact example RTC from Blynk Lib (I only added access code) this is my result
[2245] Blynk v0.3.10 on NodeMCU
[5001] Connecting to blynk-cloud.com:8442
[5554] Ready (ping: 0ms).
Current time: 0:0:16 1 1 1970
Current time: 0:0:26 1 1 1970
Current time: 0:0:36 1 1 1970
Current time: 0:0:46 1 1 1970
Current time: 0:0:56 1 1 1970
Sketch below
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.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[] = "xxx";
char ssid[] = "xxx";
char pass[] = "xxxx";
SimpleTimer timer;
WidgetRTC rtc;
BLYNK_ATTACH_WIDGET(rtc, V5);
// Utility function for digital clock display: prints preceding colon and leading 0
void printDigits(int digits)
{
Serial.print(":");
if (digits < 10) {
Serial.print('0');
}
Serial.print(digits);
}
// 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(V1, currentTime);
// Send date to the App
Blynk.virtualWrite(V2, currentDate);
}
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth, ssid, pass);
while (Blynk.connect() == false) {
// Wait until connected
}
// Begin synchronizing time
rtc.begin();
// Other Time library functions can be used, like:
// timeStatus(), setSyncInterval(interval)...
// Read more: http://www.pjrc.com/teensy/td_libs_Time.html
// Display digital clock every 10 seconds
timer.setInterval(10000L, clockDisplay);
}
void loop()
{
Blynk.run();
timer.run();
}
Close the IDE.
Cut and paste 0.4.3 libraries (all 6 of them) to somewhere for safe keeping. Don’t try to drag them anywhere.
Then delete 6 old libraries.
Paste in the 6 new libraries.
Reopen IDE and reflash your device.
SETTING UP ARDUINO IDE
Install latest Arduino IDE.
Download latest Blynk release package: Blynk_Release_v0.3.10.zip. It contains 5 libraries, please copy them to Arduino Libraries folder. If you don’t know how to do this, please follow manual installation guide.
@Badge could you please indicate why you were struggling to install 0.4.4 as it may help others.
Edit: see you have posted the problem.
@Dmitriy could you perhaps ensure that all your documentation links to the real latest release folder rather than a specific release that will be out of date in a week or two.
I know it is useful to direct users to a specific zip file for them to click on but with Blynk being so progressive it causes more problems than it solves. The links should just be to the latest releases folder at https://github.com/blynkkk/blynk-library/releases
This way some new users might actually read the release notes and understand how the libraries are to be structured. If you provide a zip link they never see the release notes.
I suggest the same for other Blynkers posting to hackster, instructables etc, don’t provide zip links and warn users that any sketch you include might need revisions to work with the latest libraries.