Brauche Hilfe bei einem Code

Hallo liebe Commuity,

ich bin ganz neu hier im Forum und hoffe das ich meinen Post richtig reingestellt habe.
Ich stehe vor einem Problem und zwar bekomme ich beim Hochladen eines Sketches folgenden Fehler angezeigt:

C:\Users\.......\OneDrive\Dokumente\Arduino\libraries\FastLED\src/FastLED.h:67,
from Z:\7-segment-clock-master\7-segment-clock-master\Arduino\clock\clock.ino:13:
C:\Users\......\OneDrive\Dokumente\Arduino\libraries\FastLED\src/fastspi.h:145:23: note: '#pragma message: No hardware SPI pins defined. All SPI access will default to bitbanged output'
145 | # pragma message "No hardware SPI pins defined. All SPI access will default to bitbanged output"
| ^<del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del><del>~</del>~~~~
Z:\7-segment-clock-master\7-segment-clock-master\Arduino\clock\clock.ino: In function 'void _Z13getIPlocationv$part$0()':
clock:79:18: error: call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)
79 | if (!http.begin(URL)) {
| <del>~</del><del>~</del>^~~~~
exit status 1
call to 'HTTPClient::begin' declared with attribute error: obsolete API, use ::begin(WiFiClient, url)

Das ist der Sketch den ich verwenden möchte.

#include <FS.h>     // this needs to be first, or it all crashes and burns...
#include <ESP8266WiFi.h>
#include <DNSServer.h>                  // Local DNS Server used for redirecting all requests to the configuration portal
#include <ESP8266WebServer.h>           // Local WebServer used to serve the configuration portal
#include <WiFiManager.h>                // https://github.com/tzapu/WiFiManager WiFi Configuration Magic
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecure.h>
#include <ArduinoOTA.h>
#include <TimeLib.h>
#include <WifiClient.h>
#include <ArduinoJson.h>                // https://github.com/bblanchon/ArduinoJson/
#include <ESP8266SSDP.h>
#define FASTLED_INTERRUPT_RETRY_COUNT 0 // https://github.com/FastLED/FastLED/issues/367 decided against disabling FASTLED_ALLOW_INTERRUPTS due to WDT resets
#include <FastLED.h>

#define NUM_LEDS_PER_SEGMENT 1
#define NUM_LEDS_HOUR (14*NUM_LEDS_PER_SEGMENT)+1
#define NUM_LEDS_MINUTE (28*NUM_LEDS_PER_SEGMENT)+3
#define DATA_PIN_HOUR D2
#define DATA_PIN_MINUTE D6

// LED
CRGB ledsHour[NUM_LEDS_HOUR];
CRGB ledsMinute[NUM_LEDS_MINUTE];
CHSV fromColor;
CHSV toColor = CHSV(128, 255, 128);
CHSV currentColor = CHSV(0, 0, 0);
CHSV savedColor;
unsigned long lastColorChangeTime = 0;
unsigned long colorSaveInterval = 15000; // milliseconds to wait for a color change to trigger a save

uint8_t lerp = 0;
bool fading = false;

int tzOffset = 0;

//flag for saving data
bool shouldSaveConfig = false;

ESP8266WebServer server(80);

// openssl s_client -connect maps.googleapis.com:443 | openssl x509 -fingerprint -noout
//const char* gMapsCrt = "92:AC:F0:5A:A8:20:A2:0D:D2:4F:20:28:2D:98:00:1F:E1:4B:99:5E";
char googleApiKey[40] = "";
char ipstackApiKey[33] = "";

String ipLatitude = "";
String ipLongitude = "";
String overrideLatitude = "";
String overrideLongitude = "";

bool isTwelveHour = false;

// TODO is this better than https://github.com/zenmanenergy/ESP8266-Arduino-Examples/blob/master/helloWorld_urlencoded/urlencode.ino ?
String UrlEncode(const String url) {
  String e;
  for (int i = 0; i < url.length(); i++) {
    char c = url.charAt(i);
    if (c == 0x20) {
      e += "%20";            // "+" only valid for some uses
    } else if (isalnum(c)) {
      e += c;
    } else {
      e += "%";
      if (c < 0x10) e += "0";
      e += String(c, HEX);
    }
  }
  return e;
}

void getIPlocation() { // Using ipstack.com to map public IP's location
  if (ipstackApiKey[0] == 0) {
    Serial.println(F("getIPlocation: no ipstack API key specified... skipping IP based geolocation"));
    return;
  }
  HTTPClient http;

  String URL = "http://api.ipstack.com/check?fields=latitude,longitude&access_key=" + String(ipstackApiKey); // no host or IP specified returns client's public IP info
  String payload;
  if (!http.begin(URL)) {
    Serial.println(F("getIPlocation: [HTTP] connect failed!"));
  } else {
    int stat = http.GET();
    if (stat > 0) {
      if (stat == HTTP_CODE_OK) {
        payload = http.getString();
        DynamicJsonBuffer jsonBuffer;
        JsonObject& root = jsonBuffer.parseObject(payload);
        if (root.success()) {
          // https://ipstack.com/documentation#errors
          JsonVariant error = root["error"];
          if (error.success()) {
            Serial.println("getIPlocation: [HTTP] error returned in response:");
            error.prettyPrintTo(Serial);
            Serial.println("");
          } else {
            ipLatitude = root["latitude"].as<String>();
            ipLongitude = root["longitude"].as<String>();
            Serial.println("getIPlocation: " + ipLatitude + "," + ipLongitude);
          }
        } else {
          Serial.println(F("getIPlocation: JSON parse failed!"));
          Serial.println(payload);
        }
      } else {
        Serial.printf("getIPlocation: [HTTP] GET reply %d\r\n", stat);
      }
    } else {
      Serial.printf("getIPlocation: [HTTP] GET failed: %s\r\n", http.errorToString(stat).c_str());
    }
  }
  http.end();
} // getIPlocation

const char* mapsHost = "maps.googleapis.com";
int getTimeZoneOffset(time_t now, String latitude, String longitude, const char* key) { // using google maps API, return TimeZone for provided timestamp
  if (key[0] == 0) {
    Serial.print(F("getTimeZoneOffset: no Google Maps API key specified... using previous tzOffset value "));
    Serial.println(tzOffset);
    return tzOffset;
  }
  if (latitude == "" || longitude == "") {
    Serial.print(F("getTimeZoneOffset: no location... using previous tzOffset value "));
    Serial.println(tzOffset);
    return tzOffset;
  }
  int offset = tzOffset; // default to returning previous offset value, to handle temporary failures
  WiFiClientSecure client;
  client.setInsecure(); // disable cert/fingerprint check
  Serial.print(F("connecting to "));
  Serial.println(mapsHost);
  if (!client.connect(mapsHost, 443)) {
    Serial.println(F("connection failed"));
    return offset;
  }

  String url = "/maps/api/timezone/json?location="
               + UrlEncode(latitude + "," + longitude) + "&timestamp=" + String(now) + "&key=" + String(key);
  Serial.print(F("requesting URL: "));
  Serial.println(url);

  client.print(String("GET ") + url + " HTTP/1.1\r\n" +
               "Host: " + mapsHost + "\r\n" +
               "Connection: close\r\n\r\n");

  Serial.println(F("request sent"));
  while (client.connected()) {
    String line = client.readStringUntil('\n');
    if (line == "\r") {
      Serial.println(F("headers received"));
      break;
    }
  }
  client.readStringUntil('{'); // workaround to fix https://github.com/leoclee/7-segment-clock/issues/6
  String line = "{" + client.readStringUntil('}') + "}";
  //  Serial.println("reply was:");
  //  Serial.println("==========");
  //  Serial.println(line);
  //  Serial.println("==========");
  //  Serial.println("closing connection");

  DynamicJsonBuffer jsonBuffer;
  JsonObject& root = jsonBuffer.parseObject(line);
  if (root.success()) {
    // https://developers.google.com/maps/documentation/timezone/intro#Responses
    String status = root["status"];
    if (status == "OK") {
      offset = int (root["rawOffset"]) + int (root["dstOffset"]);  // combine Offset and dstOffset
      const char* tzname = root["timeZoneName"];
      Serial.printf("getTimeZoneOffset: %s (%d)\r\n", tzname, offset);
    } else {
      Serial.println(F("getTimeZoneOffset: API request was unsuccessful:"));
      root.prettyPrintTo(Serial);
      Serial.println("");
    }
  } else {
    Serial.println(F("getTimeZoneOffset: JSON parse failed!"));
    Serial.println(line);
  }

  if (offset != tzOffset) {
    shouldSaveConfig = true;
  }
  Serial.print(F("getTimeZoneOffset: "));
  Serial.print(offset);
  Serial.println("");
  return offset;
} // getTimeZoneOffset

unsigned long ntpBegin;

time_t getNtpTime () {
  Serial.print("Synchronize NTP ...");
  ntpBegin = millis();
  // using 0 for timezone because fractional time zones (such as Myanmar, which is UTC+06:30) are unsupported https://github.com/esp8266/Arduino/issues/2543
  // using 0 for dst because  https://github.com/esp8266/Arduino/issues/2505
  // instead, we will add the offset to the returned value
  configTime(0, 0, "pool.ntp.org", "time.nist.gov");
  //while (millis() - ntpBegin < 5000 && time(nullptr) < 1500000000) {
  while (time(nullptr) < 1500000000) {
    delay(100);
    Serial.print(".");
  }
  Serial.println(" OK");

  return time(nullptr) + tzOffset;
}

//callback notifying us of the need to save config
void saveConfigCallback () {
  Serial.println("Should save config");
  shouldSaveConfig = true;
}

void setup() {
  Serial.begin(115200);
  Serial.println();

  // initialize and reset LEDs
  delay(1); // leds sometimes not all resetting properly without this for some reason
  FastLED.addLeds<NEOPIXEL, DATA_PIN_HOUR>(ledsHour, NUM_LEDS_HOUR);
  FastLED.addLeds<NEOPIXEL, DATA_PIN_MINUTE>(ledsMinute, NUM_LEDS_MINUTE);
  fill_solid(ledsHour, NUM_LEDS_HOUR, CRGB::Black);
  fill_solid(ledsMinute, NUM_LEDS_MINUTE, CRGB::Black);
  FastLED.show();

  //read configuration from FS json
  Serial.println("mounting FS...");

  if (SPIFFS.begin()) {
    Serial.println("mounted file system");
    if (SPIFFS.exists("/config.json")) {
      //file exists, reading and loading
      Serial.println("reading config file");
      File configFile = SPIFFS.open("/config.json", "r");
      if (configFile) {
        Serial.println("opened config file");
        size_t size = configFile.size();
        // Allocate a buffer to store contents of the file.
        std::unique_ptr<char[]> buf(new char[size]);

        configFile.readBytes(buf.get(), size);
        DynamicJsonBuffer jsonBuffer;
        JsonObject& json = jsonBuffer.parseObject(buf.get());
        json.printTo(Serial);
        if (json.success()) {
          Serial.println("\nparsed json");

          // API keys
          // json values could be null! https://arduinojson.org/v5/faq/why-does-my-device-crash-or-reboot/#example-with-strcpy
          strlcpy(googleApiKey, json["googleApiKey"] | googleApiKey, 40);
          strlcpy(ipstackApiKey, json["ipstackApiKey"] | ipstackApiKey, 33);

          // override location
          const char* lat = json["location"]["overrideLatitude"];
          const char* lng = json["location"]["overrideLongitude"];
          if (lat && lng) {
            overrideLatitude = String(lat);
            overrideLongitude = String(lng);
          }

          // time zone offset
          tzOffset = json["tzOffset"] | 0;

          // color
          JsonVariant hue = json["color"]["h"];
          JsonVariant sat = json["color"]["s"];
          JsonVariant val = json["color"]["v"];
          if (hue.success() && sat.success() && val.success()) {
            // store initial color in toColor... hopefully this is OK
            toColor = CHSV((hue.as<int>() % 360) * 255 / 360, constrain(sat.as<int>(), 0, 100) * 255 / 100, constrain(val.as<int>(), 0, 100) * 255 / 100);
          }
          savedColor = toColor;

          // clock
          JsonVariant clk = json["clock"];
          if (clk.success() && clk.is<int>()) {
            isTwelveHour = clk.as<int>() == 12;
          }
        } else {
          Serial.println("failed to load json config");
        }
      }
    } else {
      Serial.println("config file not found");
    }
  } else {
    Serial.println("failed to mount FS");
  }
  //end read

  // The extra parameters to be configured (can be either global or just in the setup)
  // After connecting, parameter.getValue() will get you the configured value
  // id/name placeholder/prompt default length
  WiFiManagerParameter customGoogleApiKey("googleApiKey", "Google API Key", googleApiKey, 40);
  WiFiManagerParameter customIpstackApiKey("ipstackApiKey", "ipstack API Key", ipstackApiKey, 33);

  //WiFiManager
  //Local intialization. Once its business is done, there is no need to keep it around
  WiFiManager wifiManager;
  wifiManager.setSaveConfigCallback(saveConfigCallback);
  wifiManager.addParameter(&customGoogleApiKey);
  wifiManager.addParameter(&customIpstackApiKey);

  //reset settings - for testing
  //wifiManager.resetSettings();

  if (!wifiManager.autoConnect()) {
    Serial.println("failed to connect and hit timeout");
    delay(3000);
    //reset and try again, or maybe put it to deep sleep
    ESP.reset();
    delay(5000);
  }

  // match the fade in color's hue and saturation
  currentColor = CHSV(toColor.h, toColor.s, 0);

  if (overrideLatitude == "" || overrideLongitude == "") {
    // if no override location specified, attempt to look up using IP based geolocation
    getIPlocation();
  }
  time_t nowUtc = getNtpTime();
  tzOffset = getTimeZoneOffset(nowUtc, (overrideLatitude != "") ? overrideLatitude : ipLatitude, (overrideLongitude != "") ? overrideLongitude : ipLongitude, googleApiKey);
  setSyncProvider(getNtpTime);
  setSyncInterval(3600);

  server.serveStatic("/", SPIFFS, "/index.html");

  server.on("/color", HTTP_PUT, []() {
    String h = server.arg("h");
    String s = server.arg("s");
    String v = server.arg("v");
    if (h != "" && s != "" && v != "") {
      setColor(h.toInt(), s.toInt(), v.toInt());
      server.send(204);
    }
  });

  server.on("/color", HTTP_GET, []() {
    const size_t bufferSize = JSON_OBJECT_SIZE(3); // https://arduinojson.org/v5/assistant/
    DynamicJsonBuffer jsonBuffer(bufferSize);

    JsonObject& root = jsonBuffer.createObject();
    root["h"] = toColor.hue * 360 / 255;
    root["s"] = toColor.saturation * 100 / 255;
    root["v"] = toColor.value * 100 / 255;

    String jsonString;
    root.printTo(jsonString);
    server.send(200, "application/json", jsonString);
  });

  server.on("/clock", HTTP_GET, []() {
    server.send(200, "text/plain", isTwelveHour ? "12" : "24");
  });

  server.on("/clock", HTTP_PUT, []() {
    String body = server.arg("plain");
    bool newIsTwelveHour;
    if (body == "12") {
      newIsTwelveHour = true;
      server.send(204);
      if (isTwelveHour != newIsTwelveHour) {
        isTwelveHour = newIsTwelveHour;
        shouldSaveConfig = true;
      }
    } else if (body == "24") {
      newIsTwelveHour = false;
      server.send(204);
      if (isTwelveHour != newIsTwelveHour) {
        isTwelveHour = newIsTwelveHour;
        shouldSaveConfig = true;
      }
    } else {
      server.send(400);
    }
  });

  server.on("/location", HTTP_GET, []() {
    const size_t bufferSize = JSON_OBJECT_SIZE(4); // https://arduinojson.org/v5/assistant/
    DynamicJsonBuffer jsonBuffer(bufferSize);

    JsonObject& root = jsonBuffer.createObject();

    root["ipLatitude"] = ipLatitude;
    root["ipLongitude"] = ipLongitude;
    root["overrideLatitude"] = overrideLatitude;
    root["overrideLongitude"] = overrideLongitude;

    String jsonString;
    root.printTo(jsonString);
    server.send(200, "application/json", jsonString);
  });

  server.on("/location", HTTP_PUT, []() {
    String lat = server.arg("overrideLatitude");
    String lng = server.arg("overrideLongitude");
    // TODO some kind of validation
    server.send(204);
    if (lat != overrideLatitude || lng != overrideLongitude) {
      overrideLatitude = lat;
      overrideLongitude = lng;
      refreshTimezoneOffset();
      shouldSaveConfig = true;
    }
  });

  server.on("/config", HTTP_GET, []() {
    const size_t bufferSize = JSON_OBJECT_SIZE(3) + 2 * JSON_OBJECT_SIZE(4); // https://arduinojson.org/v5/assistant/
    DynamicJsonBuffer jsonBuffer(bufferSize);

    JsonObject& root = jsonBuffer.createObject();

    JsonObject& color = root.createNestedObject("color");
    color["h"] = toColor.hue * 360 / 255;
    color["s"] = toColor.saturation * 100 / 255;
    color["v"] = toColor.value * 100 / 255;
    root["clock"] = isTwelveHour ? 12 : 24;
    JsonObject& location = root.createNestedObject("location");
    location["ipLatitude"] = ipLatitude;
    location["ipLongitude"] = ipLongitude;
    location["overrideLatitude"] = overrideLatitude;
    location["overrideLongitude"] = overrideLongitude;
    root["googleApiKey"] = googleApiKey;

    String jsonString;
    root.printTo(jsonString);
    server.send(200, "application/json", jsonString);
  });

  server.on("/description.xml", HTTP_GET, []() {
    SSDP.schema(server.client());
    // connection hangs for about 2 seconds otherwise
    server.client().stop();
  });

  server.begin();
  Serial.println("HTTP server started");

  // SSDP
  Serial.printf("Starting SSDP...\n");
  SSDP.setSchemaURL("description.xml");
  SSDP.setHTTPPort(80);
  SSDP.setName("7 Segment LED Clock");
  SSDP.setSerialNumber(ESP.getChipId());
  SSDP.setURL("");
  SSDP.setModelName("7 Segment LED Clock");
  SSDP.setModelNumber("LL-7S");
  SSDP.setModelURL("https://github.com/leoclee/7-segment-clock");
  SSDP.setManufacturer("Leonard Lee");
  SSDP.setManufacturerURL("https://github.com/leoclee");
  SSDP.setDeviceType("urn:schemas-upnp-org:device:7SegmentClock:1");
  SSDP.begin();

  //read updated parameters
  strcpy(googleApiKey, customGoogleApiKey.getValue());
  strcpy(ipstackApiKey, customIpstackApiKey.getValue());
  Serial.println("read updated parameters");
  Serial.println(googleApiKey);
  Serial.println(ipstackApiKey);

  //save the custom parameters to FS
  if (shouldSaveConfig) {
    saveConfig();
  }

  // OTA
  ArduinoOTA.setHostname("7sclock"); // Hostname defaults to esp8266-[ChipID]
  ArduinoOTA.onStart([]() {
    String type;
    if (ArduinoOTA.getCommand() == U_FLASH)
      type = "sketch";
    else // U_SPIFFS
      type = "filesystem";

    // NOTE: if updating SPIFFS this would be the place to unmount SPIFFS using SPIFFS.end()
    Serial.println("OTA Start updating " + type);
  });
  ArduinoOTA.onEnd([]() {
    Serial.println("\nOTA End");
  } );
  ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
    Serial.printf("OTA Progress: %u%%\r", (progress / (total / 100)));
  });
  ArduinoOTA.onError([](ota_error_t error) {
    Serial.printf("Error[%u]: ", error);
    if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
    else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
    else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
    else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
    else if (error == OTA_END_ERROR) Serial.println("End Failed");
  });
  ArduinoOTA.begin();

  //pinMode(LED_BUILTIN, OUTPUT);
  //digitalWrite(LED_BUILTIN, HIGH);

  Serial.println();
  Serial.print(F("Last reset reason: "));
  Serial.println(ESP.getResetReason());
  Serial.print(F("WiFi Hostname: "));
  Serial.println(WiFi.hostname());
  Serial.print(F("WiFi IP addr: "));
  Serial.println(WiFi.localIP());
  Serial.print(F("WiFi MAC addr: "));
  Serial.println(WiFi.macAddress());
  Serial.print(F("WiFi SSID: "));
  Serial.println(WiFi.SSID());
  Serial.print(F("ESP Sketch size: "));
  Serial.println(ESP.getSketchSize());
  Serial.print(F("ESP Flash free: "));
  Serial.println(ESP.getFreeSketchSpace());
  Serial.print(F("ESP Flash Size: "));
  Serial.println(ESP.getFlashChipRealSize());

  // TODO access point name
}

int currentMinute = 0;
boolean first = true;

void loop() {
  server.handleClient();
  ArduinoOTA.handle();
  if (timeStatus() != timeNotSet) {
    if (first) { // super dramatic fade in effect
      setColor(toColor);
      first = false;
    }
    if (minute() != currentMinute) {
      // check for new offset every hour between midnight and 4AM for DST change
      // see: https://www.timeanddate.com/time/dst/statistics.html#dstuse
      // see: https://en.wikipedia.org/wiki/Daylight_saving_time#Procedure
      if (minute() == 0 && hour() <= 4) {
        refreshTimezoneOffset();
      }
      printTime();
    }
    currentMinute = minute();

    updateLeds();
  }
  fadeToColor();
  saveColorChange();
  if (shouldSaveConfig) {
    saveConfig();
  }
}

// throttle color change induced saving to avoid unnecessary write/erase cycles
void saveColorChange() {
  if (toColor != savedColor && ((millis() - lastColorChangeTime) > colorSaveInterval)) {
    Serial.println("config save triggered by color change");
    shouldSaveConfig = true;
  }
}

void refreshTimezoneOffset() {
  // handle the scenario where override location is loaded from json, but then removed during runtime--we will need to do an ip location lookup
  if ((overrideLatitude == "" || overrideLongitude == "") && (ipLatitude == "" || ipLongitude == "")) {
    // if no override location specified, attempt to look up using IP based geolocation
    getIPlocation();
  }
  int newTzOffset = getTimeZoneOffset(now() - tzOffset, (overrideLatitude != "") ? overrideLatitude : ipLatitude, (overrideLongitude != "") ? overrideLongitude : ipLongitude, googleApiKey);
  if (newTzOffset != tzOffset) {
    tzOffset = newTzOffset;
    setTime(time(nullptr) + tzOffset);
  }
}

void saveConfig() {
  Serial.println("saving config");
  shouldSaveConfig = false; // avoid saving again, even if unsuccessful
  DynamicJsonBuffer jsonBuffer;
  JsonObject& json = jsonBuffer.createObject();
  if (googleApiKey[0] != 0) {
    json["googleApiKey"] = googleApiKey;
  }
  if (ipstackApiKey[0] != 0) {
    json["ipstackApiKey"] = ipstackApiKey;
  }
  if (overrideLatitude != "" && overrideLongitude != "") {
    JsonObject& location = json.createNestedObject("location");
    location["overrideLatitude"] = overrideLatitude;
    location["overrideLongitude"] = overrideLongitude;
  }
  JsonObject& color = json.createNestedObject("color");
  color["h"] = toColor.hue * 360 / 255;
  color["s"] = toColor.saturation * 100 / 255;
  color["v"] = toColor.value * 100 / 255;
  json["clock"] = isTwelveHour ? 12 : 24;
  json["tzOffset"] = tzOffset;

  File configFile = SPIFFS.open("/config.json", "w");
  if (!configFile) {
    Serial.println("failed to open config file for writing");
  }

  json.printTo(Serial);
  Serial.println("");
  json.printTo(configFile);
  configFile.close();

  savedColor = toColor;
}

void updateLeds() {
  fill_solid(ledsHour, NUM_LEDS_HOUR, CRGB::Black);
  ledsHour[0] = currentColor; // colon
  int displayHour = isTwelveHour ? hourFormat12() : hour();
  if (displayHour >= 10 || !isTwelveHour) {
    displayHourDigit(7 * NUM_LEDS_PER_SEGMENT + 1, displayHour / 10);
  }
  displayHourDigit(1, displayHour % 10);

  fill_solid (ledsMinute, NUM_LEDS_MINUTE, CRGB::Black);
  ledsMinute[0] = currentColor; // colon
  int displayMinute = minute();
  displayMinuteDigit(1, (displayMinute < 10) ? 0 : displayMinute / 10);
  displayMinuteDigit(7 * NUM_LEDS_PER_SEGMENT + 1, displayMinute % 10);
  ledsMinute[(14 * NUM_LEDS_PER_SEGMENT) + 1] = currentColor; // colon
  ledsMinute[(14 * NUM_LEDS_PER_SEGMENT) + 2] = currentColor; // colon
  int displaySecond = second();
  displayMinuteDigit((14 * NUM_LEDS_PER_SEGMENT) + 3, (displaySecond < 10) ? 0 : displaySecond / 10);
  displayMinuteDigit((21 * NUM_LEDS_PER_SEGMENT) + 3, displaySecond % 10);

  FastLED.show();
}

void fillSegment(struct CRGB *leds, int offset, int segmentIndex) {
  fill_solid(leds + offset + segmentIndex * NUM_LEDS_PER_SEGMENT, NUM_LEDS_PER_SEGMENT, currentColor);
}

/**
   sets the proper LEDs to the current color to display a digit on the hour (left) side of the controller, assuming that all LEDs for the digit are already set to black
*/
void displayHourDigit(int offset, int digit) {
  switch (digit) {
    case 0:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      fillSegment(ledsHour, offset, 6);
      break;
    case 1:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 4);
      break;
    case 2:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 5);
      fillSegment(ledsHour, offset, 6);
      break;
    case 3:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      break;
    case 4:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      break;
    case 5:
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      break;
    case 6:
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      fillSegment(ledsHour, offset, 6);
      break;
    case 7:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 4);
      break;
    case 8:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      fillSegment(ledsHour, offset, 6);
      break;
    case 9:
      fillSegment(ledsHour, offset, 0);
      fillSegment(ledsHour, offset, 1);
      fillSegment(ledsHour, offset, 2);
      fillSegment(ledsHour, offset, 3);
      fillSegment(ledsHour, offset, 4);
      fillSegment(ledsHour, offset, 5);
      break;
  }
}

/**
   sets the proper LEDs to the current color to display a digit on the minute (right) side of the controller, assuming that all LEDs for the digit are already set to black
*/
void displayMinuteDigit(int offset, int digit) {
  switch (digit) {
    case 0:
      fillSegment(ledsMinute, offset, 0);
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 1:
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 2:
      fillSegment(ledsMinute, offset, 0);
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 3:
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 4:
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 5:
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 5);
      break;
    case 6:
      fillSegment(ledsMinute, offset, 0);
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 5);
      break;
    case 7:
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 8:
      fillSegment(ledsMinute, offset, 0);
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
    case 9:
      fillSegment(ledsMinute, offset, 1);
      fillSegment(ledsMinute, offset, 2);
      fillSegment(ledsMinute, offset, 3);
      fillSegment(ledsMinute, offset, 4);
      fillSegment(ledsMinute, offset, 5);
      fillSegment(ledsMinute, offset, 6);
      break;
  }
}

void printTime()
{
  // digital clock display of the time
  Serial.print(isTwelveHour ? hourFormat12() : hour());
  Serial.print(":");
  printDigits(minute());
  Serial.print(":");
  printDigits(second());
  Serial.println("");

  /*
    // print free heap
    Serial.println("");
    int heap = ESP.getFreeHeap();
    Serial.println(heap);
  */
}

void printDigits(int digits)
{
  if (digits < 10)
    Serial.print('0');
  Serial.print(digits);
}

void setColor(int h, int s, int v) {
  int hue = (h % 360) * 255 / 360;
  int sat = constrain(s, 0, 100) * 255 / 100;
  int val = constrain(v, 0, 100) * 255 / 100;

  setColor(CHSV(hue, sat, val));
}

void setColor(CHSV chsv) {
  lastColorChangeTime = millis();
  Serial.print("setting color to CHSV(");
  Serial.print(chsv.h);
  Serial.print(", ");
  Serial.print(chsv.s);
  Serial.print(", ");
  Serial.print(chsv.v);
  Serial.println(")");
  fromColor = currentColor;
  toColor = chsv;
  lerp = 0;
  fading = true;
}

void fadeToColor() {
  if (fading) {
    if (lerp < 255) {
      currentColor = blend(fromColor, toColor, ++lerp);
    } else {
      fading = false;
    }
  }
}

Das ganze soll eine LED Uhr werden mit Real Clock. Hat sich mein Neffe gewünscht und wollte ihm das jetzt nachbauen.
Ich bin noch ganz am Anfang mit Arduino das programmieren zu lernen. Vielleicht hat hier ja jemand einen Rat für mich wie ich das Problem beheben kann. Habe schon gegoogelt aber leider keine hilfreiche Antwort gefunden.

M.F.G.

En3rgy

Zeile 79: Spalte 18

Der Aufruf muss berichtigt werden.

ja danke für die rasche Antwort. Aber in was muss ich das ändern? Einfach nur umscheiben oder wie? Habe leider noch nicht viel Erfahrung.

M.F.G.

En3rgy

Wie soll die mechanisch aussehen?

Bei 15 Stunden- und 31 Minuten-LEDs fehlt mir die Phantasie für eine Uhr.

Das ist die Uhr die ich nach gemacht habe..

7 Segment LED Clock by leonardlee - Thingiverse

Habe allerdings nur Stunden und Minuten genommen

M.F.G.

Ja,
if (!http.begin(WiFiClient, URL))
sollte es machen.

oder hier nachlesen:

@my_xy_projekt

Habe das so versucht aber leider bekomme ich dann eine andere Fehlermeldung.

In file included from Z:\7-segment-clock-master\7-segment-clock-master\Arduino\clock\clock.ino:15:
C:\Users\sasse\OneDrive\Dokumente\Arduino\libraries\FastLED/FastLED.h:14:21: note: '#pragma message: FastLED version 3.003.003'
   14 | #    pragma message "FastLED version 3.003.003"
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from C:\Users\sasse\OneDrive\Dokumente\Arduino\libraries\FastLED/FastLED.h:65,
                 from Z:\7-segment-clock-master\7-segment-clock-master\Arduino\clock\clock.ino:15:
C:\Users\sasse\OneDrive\Dokumente\Arduino\libraries\FastLED/fastspi.h:130:23: note: '#pragma message: No hardware SPI pins defined.  All SPI access will default to bitbanged output'
  130 | #      pragma message "No hardware SPI pins defined.  All SPI access will default to bitbanged output"
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Z:\7-segment-clock-master\7-segment-clock-master\Arduino\clock\clock.ino: In function 'void getIPlocation()':
clock:83:29: error: expected primary-expression before ',' token
   83 |   if (!http.begin(WiFiClient, URL)){
      |                             ^
exit status 1
expected primary-expression before ',' token

@Moko

Habe genau die Versionen die dort auch verwendet wurden installiert. Ausser die Arduino IDE. Da ich mich leider zu wenig auskenne weiß ich nicht wie ich das in meinem Code einfügen muss.

M.F.G.

Hier bekommst Du auch ältere versionen der IDE:

Kannst Dir ja ne portable Version draus machen:
Zip-Datei herunterladen, entpacken, im Verzeichnis einen Ordner "portable" erstellen und dann so wie bei github weitermachen.

Super das kompilieren hat geklappt danke für die Hilfe.. jetzt bin ich auf ein anderes Problem gestoßen. Bekomme jetzt die Fehlermeldung:

serial.serialutil.SerialException: could not open port 'COM19': PermissionError(13, 'Zugriff verweigert', None, 5)

M.F.G.

En3rgy

Problem gelöst. Hatte nen Programm auf das gestört hat.

Nochmals aller besten Dank für die Hilfe.. Da wird sich mein Neffe freuen.

M.F.G.

En3rgy

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.