ESP32-2432S028 Display Ansteuer Pins

Ich möchte auf einem ESP32-2432S028 den aktuellen Bitcoincurs anzeigen, dazu habe ich folgenden code erstellt.

#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include <TFT_eSPI.h> // Bibliothek für das ESP32 SYD Display

// WLAN-Zugangsdaten
const char* ssid = "TP-LINK_F4E7";
const char* password = "123AFCAFC1";

// API-URL
const char* bitcoinApiUrl = "https://api.coindesk.com/v1/bpi/currentprice/BTC.json";

// TFT-Display initialisieren
TFT_eSPI tft = TFT_eSPI();

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

// Display initialisieren
tft.init();
tft.setRotation(1); // Je nach Ausrichtung des Displays
tft.fillScreen(TFT_BLACK);
tft.setTextColor(TFT_WHITE, TFT_BLACK);
tft.setTextSize(2);

// WLAN verbinden
tft.setCursor(0, 0);
tft.println("Verbinde mit WLAN...");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("WLAN-Verbindung wird hergestellt...");
tft.print(".");
}
tft.println("\nWLAN verbunden!");
}

void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(bitcoinApiUrl);
int httpResponseCode = http.GET();

if (httpResponseCode == 200) {  // Erfolgreiche Anfrage
  String payload = http.getString();
  Serial.println(payload);

  // JSON-Daten parsen
  DynamicJsonDocument doc(2048);
  DeserializationError error = deserializeJson(doc, payload);

  if (!error) {
    // Bitcoin-Kurs in USD abrufen
    float bitcoinPrice = doc["bpi"]["USD"]["rate_float"];
    Serial.println("Bitcoin-Kurs in USD: " + String(bitcoinPrice));

    // Kurs auf dem Display anzeigen
    tft.fillScreen(TFT_GREEN);
    tft.setCursor(0, 0);
    tft.println("BTC/USD:");
    tft.setTextSize(3);
    tft.println(String(bitcoinPrice, 2));
  } else {
    Serial.println("JSON-Parsing-Fehler");
  }
} else {
  Serial.println("HTTP-Fehler: " + String(httpResponseCode));
}
http.end();

} else {
Serial.println("WLAN getrennt!");
}

delay(60000); // Aktualisierung alle 60 Sekunden
}

Der Kurs wird ordentlich abgefragt. Leider bleibt das display schwarz. Welche Pinbelegung muss ich in der User_Setup.h angeben?

WelcheS ESP32 Board verwendest du ?
Welches Display verwendest du ?
Bitte für beides einen Link posten.

Setze Deinen Sketch bitte in Codetags. Wie das geht, steht hier.
Außerdem formatiere den Code bitte ordentlich. Strg+T in der IDE hilft Dir dabei.
Das kannst Du auch noch nachträglich ändern.

Gruß Tommy

Es ist Das gelbe Display
https://de.aliexpress.com/item/1005007524304778.html?src=google&pdp_npi=4%40dis!EUR!24.56!15.39!!!!!%40!12000041140908054!ppc!!!&src=google&albch=shopping&acnt=272-267-0231&isdl=y&slnk=&plac=&mtctp=&albbt=Google_7_shopping&aff_platform=google&aff_short_key=UneMJZVf&gclsrc=aw.ds&&albagn=888888&&ds_e_adid=&ds_e_matchtype=&ds_e_device=m&ds_e_network=x&ds_e_product_group_id=&ds_e_product_id=de1005007524304778&ds_e_product_merchant_id=5407422047&ds_e_product_country=DE&ds_e_product_language=de&ds_e_product_channel=online&ds_e_product_store_id=&ds_url_v=2&albcp=20542208798&albag=&isSmbAutoCall=false&needSmbHouyi=false&gad_source=1&gclid=Cj0KCQiAx9q6BhCDARIsACwUxu7zpaIZuLHHuZyN85OxLEUykfU0Eb9Isp7o8eiS9igjbHEkkIkej5QaAkM2EALw_wcB

Danke dir, ich bin zu Faul, für den TO zu suchen.

....und wenn Du das

tust, nimmst Du bitte auch noch die Zugangsdaten zu Deinem Heimnetz raus.

Schau mal hier, das wird dir sicher helfen.

und

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