From 9a8e0268d45d6717178fab970b83432beba799ad Mon Sep 17 00:00:00 2001 From: Alexandre B Date: Fri, 12 Jan 2024 02:06:17 -0500 Subject: [PATCH] status led --- ESP32-S2-Temperature-Node/src/main.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/ESP32-S2-Temperature-Node/src/main.cpp b/ESP32-S2-Temperature-Node/src/main.cpp index 50c344048..4bb119f59 100644 --- a/ESP32-S2-Temperature-Node/src/main.cpp +++ b/ESP32-S2-Temperature-Node/src/main.cpp @@ -4,13 +4,20 @@ #include "config.h" #include "secrets.h" +// Define tasks +TaskHandle_t Status_Task; +unsigned int t = 125; + // put function declarations here: int myFunction(int, int); +void StatusCode (void* parameters); void setup() { Serial.begin(115200); Serial.println("Running setip ..."); + t = 125; + xTaskCreatePinnedToCore(StatusCode, "Status LED", 1000, NULL, 2, &Status_Task, 0); WiFi.config(INADDR_NONE, INADDR_NONE, INADDR_NONE, INADDR_NONE); WiFi.begin(WIFI_SSID, WIFI_PASSWORD); @@ -21,6 +28,8 @@ void setup() { delay(500); Serial.print("#"); } + delay(1500); + t = 1500; Serial.print("\nCONNECTED\nIP: "); Serial.println(WiFi.localIP()); @@ -29,9 +38,16 @@ void setup() { } void loop() { - - +} +void StatusCode (void* parameters) +{ + for (;;) { + digitalWrite(LED_BUILTIN, HIGH); + vTaskDelay(t); + digitalWrite(LED_BUILTIN, LOW); + vTaskDelay(t); + } } // put function definitions here: