From ef6920dbe308d4513520a7b51fc52a7ccaf617b8 Mon Sep 17 00:00:00 2001 From: Kai Lauterbach Date: Mon, 23 May 2022 17:34:59 +0200 Subject: [PATCH] Added http response handling (debug output print). --- firmware/firmware.ino | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/firmware/firmware.ino b/firmware/firmware.ino index f72329a..3009661 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -234,13 +234,24 @@ void _loop() { if (currentSensorData[SENSOR_WINDSPEED] >= HTTP_CALL_ON_WINDSPEED_EXCEED_MPS) { digitalWrite(STATUS_LED_PIN, HIGH); + // call the url HTTP_CALL_ON_WINDSPEED_URL WiFiClient client; HTTPClient http; + http.begin(client, String(HTTP_CALL_ON_WINDSPEED_URL).c_str()); - http.end(); // Send HTTP GET request int httpResponseCode = http.GET(); + + if (httpResponseCode > 0) { + String response = http.getString(); +#ifdef DEBUG + Serial.println("http response code: " + String(httpResponseCode) + " = " + response); +#endif + // TODO handle response + } + + http.end(); debug("Called windspeed exceed callout"); digitalWrite(STATUS_LED_PIN, LOW); }