v.0.2.2 ColorSerial, usage
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user