1.6.7 IDE, Generic ESP standalone. I have tried shuffling the functions to cover the strange behaviour introduced from IDE 1.6.6 onwards.
With this RTC example sketch:
/**************************************************************
* 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 <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <SimpleTimer.h>
#include <Time.h>
#include <WidgetRTC.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "YourAuthToken";
SimpleTimer timer;
WidgetRTC rtc;
BLYNK_ATTACH_WIDGET(rtc, V5)
void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Blynk.begin(auth);
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());
}
void loop()
{
Blynk.run();
timer.run();
}
I get the following error which indicates Time.h is not being picked up. When I run Time examples that uses TimeLib.h the serial time compiles ok.
In file included from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk\examples\Widgets\RTC\RTC.ino:40:0:
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/WidgetRTC.h: In member function 'void WidgetRTC::setVPin(int)':
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/WidgetRTC.h:35:36: error: 'setSyncProvider' was not declared in this scope
setSyncProvider(requestTimeSync);
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/WidgetRTC.h: In member function 'void WidgetRTC::onWrite(BlynkReq&, const BlynkParam&)':
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/WidgetRTC.h:52:26: error: 'setTime' was not declared in this scope
setTime(blynkTime); // Sync Time library clock to the value received from Blynk
^
In file included from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkApi.h:15:0,
from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/BlynkApiArduino.h:14,
from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Adapters/BlynkEthernet.h:18,
from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/BlynkSimpleEthernet.h:20,
from C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk\examples\Widgets\RTC\RTC.ino:37:
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk\examples\Widgets\RTC\RTC.ino: In function 'void clockDisplay()':
RTC:71: error: 'hour' was not declared in this scope
hour(), minute(), second(),
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
RTC:71: error: 'minute' was not declared in this scope
hour(), minute(), second(),
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
RTC:71: error: 'second' was not declared in this scope
hour(), minute(), second(),
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
RTC:72: error: 'day' was not declared in this scope
day(), month(), year());
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
RTC:72: error: 'month' was not declared in this scope
day(), month(), year());
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
RTC:72: error: 'year' was not declared in this scope
day(), month(), year());
^
C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk/Blynk/BlynkDebug.h:89:73: note: in definition of macro 'BLYNK_LOG'
#define BLYNK_LOG(msg, ...) blynk_dbg_print(BLYNK_PSTR(msg), ##__VA_ARGS__)
^
Using library SPI at version 1.0 in folder: C:\Users\maja\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0-rc2\libraries\SPI
Using library Ethernet at version 1.0.4 in folder: C:\Users\maja\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.1.0-rc2\libraries\Ethernet
Using library Blynk at version 0.3.3 in folder: C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\Blynk
Using library SimpleTimer in folder: C:\Users\Public\NewArduinoSketchesAndLibraries\libraries\SimpleTimer (legacy)
exit status 1
'hour' was not declared in this scope