hi, i try RTC example from " exemple RTC esp32 " but my arduino ide give me an error, or more.
i want esp32 works like a RTC and update date and time when it connected to server NTP .
thanks for help me
the code is this
/*************************************************************
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.
*************************************************************
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 project setup:
RTC widget (no pin required)
Value Display widget on V1
Value Display widget on V2
WARNING :
For this example you'll need 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
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#include <WiFi.h>
#include <WiFiClient.h>
#include <BlynkSimpleEsp32.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[] = "dda232c8fd3a48789e674cb780bea925";
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "ASUS";
char pass[] = "YourPassword";
BlynkTimer timer;
WidgetRTC rtc;
// 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()
{
// Debug console
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
// You can also specify server:
//Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 80);
//Blynk.begin(auth, ssid, pass, IPAddress(192,168,1,100), 8080);
// 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();
}
and arduino ide give me this
Arduino:1.8.9 (Windows 10), Scheda:"ESP32 Dev Module, Disabled, Default, QIO, 80MHz, 4MB (32Mb), 921600, None"
C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp: In function 'char* monthStr(uint8_t)':
C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp:76:66: error: 'strcpy_P' was not declared in this scope
strcpy_P(buffer, (PGM_P)pgm_read_word(&(monthNames_P[month])));
^
C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp: In function 'char* dayStr(uint8_t)':
C:\Users\steti\Documents\Arduino\libraries\Time-master\DateStrings.cpp:90:61: error: 'strcpy_P' was not declared in this scope
strcpy_P(buffer, (PGM_P)pgm_read_word(&(dayNames_P[day])));
^
PiĂą di una libreria trovata per "WiFi.h"
Usata: C:\Users\steti\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\WiFi
Non usata: C:\Users\steti\Documents\Arduino\libraries\WiFiNINA
Non usata: C:\Program Files (x86)\Arduino\libraries\WiFi
exit status 1
Errore durante la compilazione per la scheda ESP32 Dev Module.