v.0.2.2 ColorSerial, usage

This commit is contained in:
tiijay
2025-11-09 14:13:01 +01:00
parent 9d29dcd542
commit b501f2d0d2
3 changed files with 82 additions and 13 deletions

View File

@@ -197,7 +197,7 @@ void json_with_WiFiClient()
void json_with_HTTPClient()
{
Serial.println("json_with_HTTPClient()");
ColorSerial::debug("json_with_HTTPClient()");
HTTPClient http;
@@ -213,13 +213,13 @@ void json_with_HTTPClient()
return;
}
Serial.println("connected to api.open-meteo.com :-)");
Serial.println("=== Full Response Complete ===");
ColorSerial::info("connected to api.open-meteo.com :-)");
ColorSerial::info("=== Full Response Complete ===");
String payload = http.getString();
http.end();
Serial.println(payload);
ColorSerial::debug(payload.c_str());
// JSON parsen
JsonDocument doc;
@@ -233,6 +233,11 @@ void json_with_HTTPClient()
float temperature = current["temperature"];
String temp_unit = units["temperature"];
ColorSerial::temperature(temperature, temp_unit.c_str());
String temp_msg = "Temperature: " + String(temperature, 1) + temp_unit.c_str();
ColorSerial::info(temp_msg.c_str(), "Anzeige Temperatur Wert");
Serial.printf("Temperature: %.1f %s", temperature, temp_unit.c_str());
Serial.println();
}
@@ -255,17 +260,18 @@ void setup()
delay(10);
ColorSerial::header("PICO W WEATHER STATION");
ColorSerial::boxHeader("PICO W WEATHER STATION");
ColorSerial::info("System starting up", "v1.0");
connect_wifi();
if (WiFi.status() == WL_CONNECTED)
{
json_with_WiFiClient();
// json_with_WiFiClient();
json_with_HTTPClient();
}
else
{
Serial.println("WiFi NOT connected.");
ColorSerial::warning("WiFi NOT connected.");
}
setupMatrix();