Часы в Blynk

Здравствуйте! Только начал делать первые шаги в освоении IDE и Blynk! Не могли бы Вы мне помочь в некоторых вопросах? Как вывести значения времени и даты в Блинк и синхронизировать его каждые сутки? Взял пример готового кода но ничего не получилось.



/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  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
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Follow us:                  http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example runs directly on ESP8266 chip.

  Note: This requires ESP8266 support package:
    https://github.com/esp8266/Arduino

  Please be sure to select the right ESP8266 module
  in the Tools -> Board menu!

  Change WiFi ssid, pass, and Blynk auth token to run :)
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

/* Fill-in your Template ID (only if using Blynk.Cloud) */
//#define BLYNK_TEMPLATE_ID   "YourTemplateID"


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

BlynkTimer timer; 

WidgetRTC rtc;

String week = " ";
String currentTime; // переменная хранит время
String currentDate; // переменная хранит дату
String minutenorm; // переменная для преобразования минут в нормальный формат
long timenow = 0; // текущее время в секундах
boolean firststart; //переменная хранящая значение первый ли это старт, чтобы при старте устройства не писалось сообщение о подключении к облаку.

void autoplay() {
// ЧАСЫ И ДАТА  
 if (minute() < 10) {minutenorm = String("0") + minute();} // необходимо для преобразования минут в формат 00 - 59
 else {minutenorm = minute();}
 currentTime = String(hour()) + ":" + minutenorm; //записываем в переменную время
 switch (weekday()) {
    case 1:
      week = "Sun";
      break;
    case 2:
      week = "Mon";
      break;
    case 3:
      week = "Tue"; 
      break;
    case 4:
      week = "Wed";
      break;
    case 5:
      week = "Thu";
      break;
    case 6:
      week = "Fri";
      break;
    case 7:
      week = "Sat";
      break;
    default: 
      week = "Err";
 }     
 currentDate = String(day()) + "." + month() + "." + year() + " " + week; //записываем в переменную дату
 Blynk.virtualWrite(V1, currentTime); // выводим в приложение время
 Blynk.virtualWrite(V2, currentDate); // выводим в приложение дату  
// УРОВЕНЬ WI-FI
 Blynk.virtualWrite(V3, WiFi.RSSI()); 
 timenow = hour()*3600 + minute()*60 + second(); //текущее время в секундах


 }
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "**********";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "*******";
char pass[] = "*******";

void setup()
{
  // Debug console
  Serial.begin(9600);

  Blynk.begin(auth, ssid, pass);
}

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

Are you using the now unsupported Blynk Legacy, or the new Blynk IoT?

The answer is different depending on the platform.

Pete.

Yes, everything is fine now! Now I’m wondering how to output the time and date values to the Blink and synchronize it every day?

Can’t help you if you don’t answer my question!

Pete.

I just didn’t understand your question

Blynk Legacy
Also known as Blynk 0.1
Development and supported ended around 3 years ago
Sign-up for new accounts is no longer allowed.

Blynk IoT
Also known as New Blynk, or Blynk 2.0
Available in Basic (Free) Plus, Pro and White Label versions.
Sign-up via Blynk.io

Which are you using?

Pete.

does that change anything? I just need to display the time and date values in the widget

Yes, as I said earlier…

Add the RTC widget to your app project, then use this example…

Pete.

and how do I add “0” to the minutes in this sketch if it is less than “10”

thanks for the example! it worked right away!

Use Sprinf to format the data.

Pete.

In my example, there is a variable “minutenorm”. I understand that I need to create a condition for it, but first it needs to be declared. And how to do it and where?

I don’t understand your question.

Pete.

if {(minute() < 10) {minutenorm = String(“0”) + minute();}
else {minutenorm = minute();}

and how do I add and where is “minutenorm”