Set up scheduled program cycles #24

Merged
W1CDN merged 41 commits from program-cycle into main 2023-09-15 16:51:45 -05:00
2 changed files with 9 additions and 5 deletions
Showing only changes of commit a69128397a - Show all commits

View File

@ -10,7 +10,7 @@
[env:esp32doit-devkit-v1]
platform = espressif32
build_flags =
;build_flags =
; -std=c++11
; -std=gnu++11
board = esp32doit-devkit-v1

View File

@ -162,10 +162,11 @@ const int blinker = LED_BUILTIN;
// Timers
//auto timer = timer_create_default();
Timer<1> timer;
auto time_until_start = timer_create_default();
// Example from https://github.com/contrem/arduino-timer#examples
bool toggle_led(void *) {
Serial.print("Timer time: ");
Serial.println(rtc.now().timestamp());
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN)); // toggle the LED
return true; // keep timer active? true
}
@ -602,11 +603,17 @@ void setup() {
yourInputStartTimeUnix = atol(inputMessage.c_str());
//}
Serial.println(yourInputStartTimeUnix);
timer.at(millis() + 10000, toggle_led);
Serial.println(millis());
auto active_tasks = timer.size();
Serial.println(active_tasks);
}
// else {
// inputMessage = "No message sent";
// }
//request->send(200, "text/plain", inputMessage);
// https://techtutorialsx.com/2018/01/14/esp32-arduino-http-server-external-and-internal-redirects/
request->redirect("/");
});
server.onNotFound(notFound);
@ -621,13 +628,10 @@ void setup() {
// sender.setMessage(String("73 de kb3jcy "));
// sender.startSending();
}
void loop() {
// Timers
time_until_start.tick();
timer.tick();
// DateTime now = rtc.now();