pre
This commit is contained in:
parent
63d9bfb524
commit
cf35e07c2f
7 changed files with 68 additions and 38 deletions
30
Template Project/src/rtc_demo.cpp.disabled
Normal file
30
Template Project/src/rtc_demo.cpp.disabled
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include <ESPMegaPRO.h>
|
||||
#include <ETH.h>
|
||||
|
||||
uint8_t utc_offset = 7;
|
||||
|
||||
IPAddress IP(192, 168, 0, 241);
|
||||
IPAddress SUBNET(255, 255, 255, 0);
|
||||
IPAddress GATEWAY(192, 168, 0, 1);
|
||||
IPAddress DNS(10, 192, 1, 1);
|
||||
|
||||
void setup()
|
||||
{
|
||||
ESPMega_begin();
|
||||
Serial.begin(115200);
|
||||
ETH.begin();
|
||||
ETH.config(IP, GATEWAY, SUBNET, DNS, DNS);
|
||||
delay(5000);
|
||||
char ntp[19];
|
||||
DNS.toString().toCharArray(ntp, 19);
|
||||
ESPMega_configNTP(utc_offset * 3600, 0, ntp);
|
||||
ESPMega_updateTimeFromNTP();
|
||||
//ESPMega_setTime(0,10,52,9,11,2008);
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
rtctime_t time = ESPMega_getTime();
|
||||
Serial.printf("RTC: %02d:%02d:%02d %02d/%02d/%04d\n", time.hours, time.minutes, time.seconds, time.day, time.month, time.year);
|
||||
delay(1000);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue