BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Blynk RTC sketch upload


#1

Simple RTC time sketch. Cannot upload, because Arduino ide showing lots of errors. Hardware: Wemos D1. Latest IDE. Errors bellow.



#define BLYNK_PRINT Serial

#include <TimeLib.h>
#include <WidgetRTC.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

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

char ssid[] = "********";
char pass[] = "*********";


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


  Blynk.virtualWrite(V1, currentTime);

  Blynk.virtualWrite(V2, currentDate);
}

BLYNK_CONNECTED() {
  
  rtc.begin();
}

void setup()
{

Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);

  setSyncInterval(10 * 60); // Sync interval in seconds (10 minutes)

  timer.setInterval(10000L, clockDisplay);
}

void loop()
{
  Blynk.run();
  timer.run();
}



Build options changed, rebuilding all
In file included from C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/WidgetRTC.h:18:0,

                 from C:\Users\MONTI_~1\AppData\Local\Temp\arduino_modified_sketch_899916\ESP8266_Standalone.ino:5:

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setLabel(Args ...)':

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:27:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "label", args...);

         ^

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setColor(Args ...)':

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:32:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "color", args...);

         ^

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setMin(Args ...)':

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:37:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "min", args...);

         ^

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h: In member function 'void BlynkWidgetBase::setMax(Args ...)':

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/Blynk/BlynkWidgetBase.h:42:9: error: 'Blynk' was not declared in this scope

         Blynk.setProperty(mPin, "max", args...);

         ^

In file included from C:\Users\MONTI_~1\AppData\Local\Temp\arduino_modified_sketch_899916\ESP8266_Standalone.ino:5:0:

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/WidgetRTC.h: In static member function 'static time_t WidgetRTC::requestTimeSync()':

C:\Users\monti_000\Documents\MEGA\Arduino\libraries\Blynk\src/WidgetRTC.h:37:5: error: 'Blynk' was not declared in this scope

     Blynk.sendInternal("rtc", "sync");

     ^

exit status 1
Error compiling for board WeMos D1 R1.


#2

Try reinstalling the Blynk Library… manually as recommended…


#3

Had to upgrade Arduino IDE as well, solved now. Thank you.