Set up scheduled program cycles #24
|
@ -555,9 +555,16 @@ void setup() {
|
|||
inputMessage = request->getParam(PARAM_TIME)->value();
|
||||
//https://stackoverflow.com/a/22733127/2152245
|
||||
yourInputTime = atol(inputMessage.c_str());
|
||||
Serial.print("yourInputTime: ");
|
||||
Serial.println(yourInputTime);
|
||||
// update the RTC time
|
||||
rtc.adjust(DateTime(yourInputTime));
|
||||
// Might work to fix random errors? If date is far in the future,
|
||||
// try to update again.
|
||||
while(rtc.now().year() > 2100){
|
||||
Serial.println("RTC can't set time. Trying again.");
|
||||
rtc.adjust(DateTime(yourInputTime));
|
||||
}
|
||||
;
|
||||
DateTime now = rtc.now();
|
||||
Serial.print("UTC time from browser: ");
|
||||
|
@ -575,6 +582,9 @@ void setup() {
|
|||
Serial.print(':');
|
||||
Serial.print(now.second(), DEC);
|
||||
Serial.println();
|
||||
|
||||
Serial.print("rtc.now().unixtime(): ");
|
||||
Serial.println(rtc.now().unixtime());
|
||||
}
|
||||
// GET inputFloat value on <ESP_IP>/get?inputFloat=<inputMessage>
|
||||
if (request->hasParam(PARAM_FLOAT)) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user