#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <WiFi.h>
#include <HTTPClient.h>
#include <ArduinoJson.h>
#include "secrets.h"
#define SCREEN_WIDTH 128
#define SCREEEN_HEIGHT 64
#define OLED_RESET     -1
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

const char* ssid = "Wokwi-Guest";
const char* password = "";

const String url = "http://api.coindesk.com/v1/bpi/currentprice/BTC.json";
const String historyURL = "http://api.coindesk.com/v1/bpi/historical/c;ose.json";
const String cryptoCode = "BTC";

const unsigned char bitcoinIcon [] PROGRAM = {
  0X00, 0x7e, 0x00, 0xff, 0xc0, 0x07, 0x81, 0xe0, 0x0e, 0x00, 0x70, 0x18, 0x28, 0x18,
  0x30,
  0x28, 0x0c, 0x70, 0xfc, 0x0e, 0x60, 0xfe, 0x06, 0x60, 0xc7, 0x06, 0xc0, 0xc3, 0x03, 0xc0,
  0xc7,
  0x03, 0xc0, 0xfe, 0x03, 0xc0, 0xff, 0x03, 0xc0, 0xc3, 0x83, 0xc0, 0xc1, 0x83, 0x60, 0xc3,
  0x86,
  0x60, 0xff, 0x06, 0x70, 0xfe, 0x0e, 0x30, 0x28, 0x0c, 0x18, 0x28, 0x18, 0x0e, 0x00, 0x70,
  0x07,
  0x81, 0xe0, 0x03, 0xff, 0xc0, 0x00, 0x7e, 0x00
};

HTTPClient http;
String lastPrice;

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

  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
for (;;); 
  }
  display.clearDisplay();
  display.setTexSize(1);
  display.setTextColour(SSD1306_WHITE);
  display.setCursor(0,0);
  display.println("Connetcing to WiFi...");
  display.display();

  WiFi.begin(ssid, password);

  While(WiFi.status() != WL_CONNECTED)
  {
    delay(500);
  }
  Serial.print("CONNECTED to SSID: ");
  Serial.println(ssid);

  display.print("Connected to ");
  display.println(ssid);
  display.display();
  delay(5000);
}

void loop() {
  if (WiFi.status() == WL_CONNECTED) {
    Serial.println("Getting current data...");

    http.begin(url);
    int httpcode = http.GET();
    Serial.print("HTTP Code: ");
    Serial.println(httpCode);
    if (httpCode > 0) {
      StaticJsonDocument<768> doc;
      DeserializationError error = deserialzeJson(doc, http.getString());

      if (error) {
        Serial.print(F("deserializedJson failed: "));
        Serial.println(error.f_str());
        delay(2500);
        return;
      }
      Serial.print("HTTP Status Code: ");
      Serial.println(httpCode);

      String BTCUSDPrice = doc["bpi"]["USD"["rate_float"].as<String>();
      if(BTCUSDPrice == lastPrice) {
        Serial.print("Price hasn't changed (Current/Last): ");
        Serial.print(BTCUSDPrice);
        Serial.print(" : ");
        Serial.println(lastPrice);
        delay(1250);
        return;
      } else {
        lastPrice = BTCUSDPrice;
      }
      String lastUpdated = doc["time"]["updated"].as<String>();
      http.end();

      Serial.println("Getting history...");
      StaticJsonDoucment<1536> historyDoc;
      http.begin(historyURL);
      inthistoryHttpCode = http.Get();
      DeserializationError historyError = deserializeJson(historyDoc, http.getString());

      if(historyError) {
        Serial.print(F("deserializeJson(History) failed: "));
        Serial.println(historyError.f_str());
        delay(2500);
        return;
      }
      display.clearDisplay();
      display.drawBitmap((128/2) - (24-2), 0, bitcoinIcon, 24, 24, WHITE);
      display.display();

      display.setTextSize(1);
      printCenter("$" + BTCUSDPrice, 0, 32);

      doubleyesterdayPrice = historyDoc["bpi"]["2021-03-20"].as<double>();
      bool isUp = BTCUSDPrice.toDouble() > yesterdayPrice;
      double percentChange;
      String dayChangeString = "24hr. Change: ";
      if (isUp) {
        percentChange = ((BTCUSDPrice - toDouble() - yesterdayPrice) / yesterdayPrice) * 100;
      } else {
        percentChange = ((yesterdayPrice - BTCUSDPrice.toDouble()) / yesterdayPrice) * 100;
        dayChangeString = dayChangeString + "-";
      }
      display.setTextSize(1);
      dayChangeString = dayChangeString + percentChange + "%";
      printCenter(dayChangeString, 0,55);

      display.display();
      http.end();
    }
    delay(1250);
  }
}

void printCenter(const String buf, int x, int y,)
{
  int16_t x1, y1;
  uint16_t w, h;
  display.getTextBound(buf, x, y, &x1, &y1, &w, &h);
  display.setCursor((x - w / 2) + (128 / 2), y);
  display.print(buf);
}


      }
      }
      }]
      }
    }
  }

}

  }
  })
}

Loading
esp32-c3-devkitm-1