LEDs didn't work

I want that when coin change is positive, upled works, when coin change is negative, downled works. However, I couldn't do that. Please help me thank you

//mucitpilot kripto para takip uygulaması
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <WiFiClientSecureBearSSL.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <ArduinoJson.h> //5 nolu sürümü yükleyin 6 ile çalışmaz

// Ağ adı ve şifresini girin
#define WIFI_SSID "ATA CUMHURIYETI"
#define WIFI_PASS "19982002"

// setup zamanı (sn)
#define SETUP_TIME 4

// Ekran yenileme zamanı (sn)
#define UPDATE_TIME 5

// Kripto para için kullanılacak para birimi: eur / usd / gbp olabilir.
#define CURRENCY_CODE "usd"
// para birimi veya sembol, tested: harfler veya $ işareti olabilir.
#define CURRENCY_SYM '$'
#define upLED 13
#define downLED 12
#define blue 15
//Https yani güvenli bağlantı için sitelere ait gerekli parmak izi bilgileri
//bir sitenin fingerprintini bulmak için https://www.grc.com/fingerprints.htm  adresini kullanabiliriz.
// Fingerprint ---> api.cryptonator.com - 6 Şubat 2022'ye kadar geçerli
const uint8_t fingerprint_crypto[20] = {0x10, 0x76, 0x19, 0x6B, 0xE9, 0xE5, 0x87, 0x5A, 0x26, 0x12, 0x15, 0xDE, 0x9F, 0x7D, 0x3B, 0x92, 0x9A, 0x7F, 0x30, 0x13};

// OLED Ekran tanımlamaları
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define SCREEN_ADDRESS 0x3C
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

// Coin'lere ait logoların ebatı 48x48 piksel olmalı
//http://javl.github.io/image2cpp/ sitesini kullanarak monokrom bitmap'leriniz için gerekli kodu üretebilirsiniz.
#define LOGO_GENISLIK 48
#define LOGO_YUKSEKLIK 48

// Coinlerimize ait bilgileri saklamak için bir veri tipi bloğu oluşturuyoruz.
struct asset {
  String assetName;
  String url;
  const unsigned char logo [288];
};

// Kullanacağımız tüm coin'ler için bilgileri oluşturmamız gerekli
// Yeni bir COIN eklemek isterseniz:
//  1: Aşağıdaki örneklerden birini kopyalayıp yapıştırın
//  2: Kripto ismini güncelleyin
//  3: api.cryptonator.com sitesinden o coin için gerekli linki alın
//  4: http://javl.github.io/image2cpp/ sitesini kullanarak o coin için 48x48'lik bir simge olşturun
asset assets[] = {
  // Doge coin bilgileri
  { "Doge",
    "https://api.cryptonator.com/api/ticker/doge-" + String(CURRENCY_CODE),
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00,
      0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x07, 0x00, 0x00, 0x01, 0xa0, 0x00, 0x0f, 0x00, 0x00, 0x01,
      0x80, 0x00, 0x1f, 0x00, 0x00, 0x01, 0x98, 0x00, 0x3e, 0x00, 0x00, 0x01, 0x80, 0x00, 0x7e, 0x00,
      0x00, 0x01, 0x83, 0xe1, 0xf8, 0x00, 0x00, 0x01, 0x83, 0xe1, 0xf8, 0x00, 0x00, 0x01, 0x3f, 0xfd,
      0xd8, 0x00, 0x00, 0x07, 0xff, 0xfe, 0x10, 0x00, 0x00, 0x1f, 0xe7, 0xff, 0x90, 0x00, 0x00, 0x7f,
      0xe7, 0xff, 0x80, 0x00, 0x01, 0xff, 0xdf, 0xff, 0xf0, 0x00, 0x03, 0xff, 0xdf, 0xff, 0xff, 0x00,
      0x03, 0xff, 0xdf, 0xff, 0xff, 0x80, 0x07, 0xc7, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xc7, 0xff, 0xff,
      0xff, 0xc0, 0x07, 0xe7, 0xff, 0xff, 0xff, 0xc0, 0x0f, 0xcf, 0xfd, 0x1f, 0xff, 0xc0, 0x0f, 0xff,
      0xfe, 0x0f, 0xff, 0xe0, 0x0f, 0xff, 0xfa, 0x1f, 0xff, 0xe0, 0x1f, 0xff, 0xfe, 0x7f, 0xff, 0xe0,
      0x1f, 0xdf, 0xff, 0xff, 0xff, 0xe0, 0x1e, 0x07, 0xff, 0xff, 0xff, 0xe0, 0x1e, 0x01, 0xff, 0xff,
      0xff, 0xe0, 0x1e, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x1e, 0x01, 0xff, 0xff, 0xff, 0xe0, 0x1e, 0x0f,
      0xff, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xe0, 0x1f, 0xff, 0xff, 0xff, 0xff, 0xe0,
      0x0f, 0x9f, 0xff, 0xff, 0xff, 0xe0, 0x0e, 0x07, 0xff, 0xff, 0xff, 0xe0, 0x0f, 0xc0, 0x1f, 0xff,
      0xff, 0xc0, 0x0f, 0xc0, 0x1f, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff,
      0xff, 0xff, 0xff, 0x80, 0x03, 0xff, 0xff, 0xff, 0xff, 0x80, 0x01, 0xff, 0xff, 0xff, 0xff, 0x00,
      0x01, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x1f, 0xff, 0xff,
      0xf0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x01,
      0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x3f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    }
  },
  // BTC ayarları
  { "BTC",
    "https://api.cryptonator.com/api/ticker/btc-" + String(CURRENCY_CODE),
    { 0x00, 0x00, 0x0f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff,
      0xc0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x7f,
      0xff, 0xff, 0xfe, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x01, 0xff, 0xff, 0xff, 0xff, 0x80,
      0x03, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x07, 0xff, 0xfe, 0x3f, 0xff, 0xe0, 0x0f, 0xff, 0xfe, 0x73,
      0xff, 0xf0, 0x0f, 0xff, 0xfc, 0x63, 0xff, 0xf0, 0x1f, 0xff, 0x0c, 0x63, 0xff, 0xf8, 0x1f, 0xff,
      0x00, 0x63, 0xff, 0xfc, 0x3f, 0xff, 0x80, 0x07, 0xff, 0xfc, 0x3f, 0xff, 0xe0, 0x01, 0xff, 0xfc,
      0x7f, 0xff, 0xe0, 0x80, 0x7f, 0xfe, 0x7f, 0xff, 0xe0, 0xf0, 0x3f, 0xfe, 0x7f, 0xff, 0xe1, 0xf8,
      0x3f, 0xfe, 0xff, 0xff, 0xc1, 0xf8, 0x1f, 0xff, 0xff, 0xff, 0xc1, 0xf8, 0x1f, 0xff, 0xff, 0xff,
      0xc1, 0xf8, 0x3f, 0xff, 0xff, 0xff, 0xc0, 0x00, 0x3f, 0xff, 0xff, 0xff, 0x80, 0x00, 0x7f, 0xff,
      0xff, 0xff, 0x82, 0x00, 0xff, 0xff, 0xff, 0xff, 0x83, 0xc0, 0x7f, 0xff, 0xff, 0xff, 0x87, 0xf0,
      0x3f, 0xff, 0xff, 0xff, 0x07, 0xf8, 0x3f, 0xff, 0xff, 0xfb, 0x07, 0xf8, 0x3f, 0xff, 0x7f, 0xf8,
      0x07, 0xf0, 0x3f, 0xfe, 0x7f, 0xf0, 0x03, 0xf0, 0x3f, 0xfe, 0x7f, 0xf8, 0x00, 0x00, 0x7f, 0xfe,
      0x3f, 0xff, 0x80, 0x00, 0x7f, 0xfc, 0x3f, 0xff, 0x88, 0x00, 0xff, 0xfc, 0x3f, 0xff, 0x9c, 0x43,
      0xff, 0xfc, 0x1f, 0xff, 0x18, 0xff, 0xff, 0xf8, 0x0f, 0xff, 0x18, 0xff, 0xff, 0xf8, 0x0f, 0xff,
      0xf8, 0xff, 0xff, 0xf0, 0x07, 0xff, 0xfd, 0xff, 0xff, 0xe0, 0x03, 0xff, 0xff, 0xff, 0xff, 0xc0,
      0x01, 0xff, 0xff, 0xff, 0xff, 0x80, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x7f, 0xff, 0xff,
      0xfe, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfc, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf0, 0x00, 0x00, 0x07,
      0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x00
    }
  },
  // ETH ayarları
  { "ETH",
    "https://api.cryptonator.com/api/ticker/eth-" + String(CURRENCY_CODE),
    { 0x00, 0x00, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff,
      0xc0, 0x00, 0x00, 0x0f, 0xfe, 0xff, 0xf0, 0x00, 0x00, 0x1f, 0xfc, 0x7f, 0xfc, 0x00, 0x00, 0x7f,
      0xfc, 0x7f, 0xfe, 0x00, 0x00, 0xff, 0xf8, 0x3f, 0xff, 0x00, 0x01, 0xff, 0xf0, 0x1f, 0xff, 0x80,
      0x03, 0xff, 0xf0, 0x1f, 0xff, 0xc0, 0x07, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x07, 0xff, 0xe0, 0x07,
      0xff, 0xf0, 0x0f, 0xff, 0xc0, 0x07, 0xff, 0xf0, 0x1f, 0xff, 0x80, 0x03, 0xff, 0xf8, 0x1f, 0xff,
      0x80, 0x03, 0xff, 0xf8, 0x3f, 0xff, 0x00, 0x01, 0xff, 0xfc, 0x3f, 0xff, 0x00, 0x00, 0xff, 0xfc,
      0x7f, 0xfe, 0x00, 0x00, 0xff, 0xfe, 0x7f, 0xfc, 0x00, 0x00, 0x7f, 0xfe, 0x7f, 0xfc, 0x00, 0x00,
      0x7f, 0xfe, 0x7f, 0xf8, 0x00, 0x00, 0x3f, 0xfe, 0xff, 0xf8, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xf0,
      0x00, 0x00, 0x1f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff,
      0xff, 0xe0, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x00,
      0x7f, 0xff, 0x7f, 0xe7, 0x00, 0x01, 0xcf, 0xff, 0x7f, 0xf3, 0xc0, 0x07, 0x9f, 0xff, 0x7f, 0xf8,
      0xf0, 0x0e, 0x3f, 0xfe, 0x7f, 0xf8, 0x38, 0x3c, 0x3f, 0xfe, 0x7f, 0xfc, 0x1e, 0xf0, 0x7f, 0xfe,
      0x3f, 0xfe, 0x07, 0xc0, 0xff, 0xfe, 0x3f, 0xff, 0x03, 0x80, 0xff, 0xfc, 0x1f, 0xff, 0x00, 0x01,
      0xff, 0xfc, 0x1f, 0xff, 0x80, 0x03, 0xff, 0xf8, 0x0f, 0xff, 0xc0, 0x07, 0xff, 0xf0, 0x0f, 0xff,
      0xc0, 0x07, 0xff, 0xf0, 0x07, 0xff, 0xe0, 0x0f, 0xff, 0xe0, 0x03, 0xff, 0xf0, 0x1f, 0xff, 0xc0,
      0x01, 0xff, 0xf0, 0x1f, 0xff, 0xc0, 0x00, 0xff, 0xf8, 0x3f, 0xff, 0x00, 0x00, 0x7f, 0xfc, 0x7f,
      0xfe, 0x00, 0x00, 0x3f, 0xfe, 0x7f, 0xfc, 0x00, 0x00, 0x0f, 0xff, 0xff, 0xf8, 0x00, 0x00, 0x07,
      0xff, 0xff, 0xe0, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x00, 0x00, 0x00, 0x1f, 0xf0, 0x00, 0x00
    }
  },
  // XLM ayarları
  { "Stellar",
    "https://api.cryptonator.com/api/ticker/xlm-" + String(CURRENCY_CODE),
    { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00,
      0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0xff, 0xff, 0xc0, 0x03, 0x00, 0x0f, 0xfc, 0x3f, 0xf0, 0x0f,
      0x00, 0x1f, 0xc0, 0x03, 0xc0, 0x3f, 0x00, 0x3f, 0x00, 0x00, 0x00, 0xff, 0x00, 0x7c, 0x00, 0x00,
      0x03, 0xfc, 0x00, 0xf8, 0x00, 0x00, 0x0f, 0xf0, 0x01, 0xf0, 0x00, 0x00, 0x3f, 0xe0, 0x01, 0xe0,
      0x00, 0x00, 0xff, 0x80, 0x03, 0xc0, 0x00, 0x03, 0xfe, 0x01, 0x03, 0xc0, 0x00, 0x07, 0xf8, 0x07,
      0x07, 0x80, 0x00, 0x3f, 0xe0, 0x1f, 0x07, 0x80, 0x00, 0x7f, 0x80, 0x7f, 0x0f, 0x00, 0x01, 0xfe,
      0x01, 0xfe, 0x0f, 0x00, 0x07, 0xf8, 0x07, 0xf8, 0x0f, 0x00, 0x1f, 0xe0, 0x1f, 0xf8, 0x0f, 0x00,
      0x7f, 0x80, 0x7f, 0xf0, 0x0e, 0x01, 0xfe, 0x01, 0xfe, 0x70, 0x0e, 0x07, 0xf8, 0x07, 0xf8, 0x70,
      0x0e, 0x1f, 0xe0, 0x1f, 0xe0, 0x70, 0x0e, 0x7f, 0x80, 0x7f, 0x80, 0x70, 0x0f, 0xfe, 0x01, 0xfe,
      0x00, 0xf0, 0x1f, 0xf8, 0x07, 0xf8, 0x00, 0xf0, 0x1f, 0xe0, 0x1f, 0xe0, 0x00, 0xf0, 0x7f, 0x80,
      0x7f, 0x80, 0x00, 0xf0, 0xfe, 0x01, 0xfe, 0x00, 0x01, 0xe0, 0xf8, 0x07, 0xfc, 0x00, 0x01, 0xe0,
      0xe0, 0x1f, 0xe0, 0x00, 0x03, 0xc0, 0x80, 0x7f, 0xc0, 0x00, 0x03, 0xc0, 0x01, 0xff, 0x00, 0x00,
      0x07, 0x80, 0x07, 0xfc, 0x00, 0x00, 0x0f, 0x80, 0x0f, 0xf0, 0x00, 0x00, 0x1f, 0x00, 0x3f, 0xc0,
      0x00, 0x00, 0x3e, 0x00, 0xff, 0x00, 0x00, 0x00, 0xfc, 0x00, 0xfc, 0x03, 0xc0, 0x03, 0xf8, 0x00,
      0xf0, 0x0f, 0xfc, 0x3f, 0xf0, 0x00, 0xc0, 0x03, 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0xff, 0xff,
      0x00, 0x00, 0x00, 0x00, 0x3f, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    }
  },
  // ADA ayarları
  { "Cardano",
    "https://api.cryptonator.com/api/ticker/ada-" + String(CURRENCY_CODE),
    { 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
      0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x07, 0x03, 0x81, 0xc0, 0x00,
      0x00, 0x07, 0x03, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x30, 0x08, 0x00, 0x00, 0x0c, 0x00, 0xfc, 0x3e, 0x00, 0x60, 0x0c, 0x00,
      0xfc, 0x7f, 0x00, 0x20, 0x00, 0x31, 0xfe, 0x7f, 0x08, 0x00, 0x00, 0x79, 0xfe, 0x7f, 0x1c, 0x00,
      0x00, 0x79, 0xfe, 0x7f, 0x1c, 0x00, 0x00, 0x30, 0xfc, 0x7f, 0x1c, 0x00, 0x00, 0x00, 0x78, 0x3e,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x01, 0xe0, 0x00, 0x00, 0x1f,
      0x80, 0x03, 0xf0, 0x00, 0x00, 0x1f, 0xc0, 0x03, 0xf8, 0x60, 0x46, 0x1f, 0xc0, 0x03, 0xf8, 0xe2,
      0xce, 0x1f, 0xc0, 0x03, 0xf8, 0x62, 0x04, 0x1f, 0xc0, 0x03, 0xf8, 0x00, 0x00, 0x0f, 0x80, 0x03,
      0xf0, 0x00, 0x00, 0x07, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x7c, 0x3e, 0x00, 0x00, 0x00, 0x30, 0xfc, 0x7f, 0x1c, 0x00, 0x00, 0x79, 0xfe, 0x7f, 0x1c, 0x00,
      0x00, 0x71, 0xfe, 0x7f, 0x1c, 0x00, 0x00, 0x01, 0xfe, 0x7f, 0x00, 0x00, 0x0c, 0x00, 0xfc, 0x7f,
      0x00, 0x60, 0x0c, 0x00, 0x7c, 0x3e, 0x00, 0x60, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00, 0x03, 0x03, 0xc0, 0xc0, 0x00,
      0x00, 0x03, 0x03, 0x80, 0xc0, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
      0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
      0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x01, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    }
  }


};

// Yükseliş / Düşüş Trend Okları 45x26piksel
#define OK_GENISLIK 45
#define OK_YUKSEKLIK 26

// Bitmap olarak Yükseliş Oku
const unsigned char stonks [] PROGMEM = {
  0x00, 0x00, 0x00, 0x07, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x03, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x01,
  0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xf8, 0x00, 0x00,
  0x00, 0x00, 0x3f, 0xf8, 0x00, 0x03, 0x00, 0x00, 0x1f, 0xf8, 0x00, 0x03, 0x80, 0x00, 0x3f, 0xf8,
  0x00, 0x07, 0xc0, 0x00, 0x7f, 0xf8, 0x00, 0x0f, 0xe0, 0x00, 0xff, 0xf8, 0x00, 0x1f, 0xf0, 0x01,
  0xfd, 0xf8, 0x00, 0x1f, 0xf8, 0x03, 0xf8, 0xf8, 0x00, 0x3f, 0xfc, 0x07, 0xf0, 0x78, 0x00, 0x7c,
  0xfe, 0x0f, 0xf0, 0x38, 0x00, 0xf8, 0xff, 0x1f, 0xe0, 0x18, 0x00, 0xf0, 0x7f, 0xbf, 0xc0, 0x08,
  0x01, 0xe0, 0x3f, 0xff, 0x80, 0x00, 0x03, 0xc0, 0x1f, 0xff, 0x00, 0x00, 0x07, 0x00, 0x0f, 0xfe,
  0x00, 0x00, 0x06, 0x00, 0x07, 0xfc, 0x00, 0x00, 0x0c, 0x00, 0x03, 0xf8, 0x00, 0x00, 0x18, 0x00,
  0x01, 0xf0, 0x00, 0x00, 0x30, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x20, 0x00, 0x00, 0x40, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};

// Bitmap olarak Düşüş Oku
const unsigned char notstonks [] PROGMEM = {
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
  0x00, 0x20, 0x00, 0x00, 0x38, 0x00, 0x00, 0x60, 0x00, 0x00, 0x7c, 0x00, 0x00, 0xc0, 0x00, 0x00,
  0xfe, 0x00, 0x01, 0x80, 0x00, 0x01, 0xff, 0x00, 0x03, 0x00, 0x00, 0x03, 0xff, 0x80, 0x07, 0x00,
  0x00, 0x07, 0xff, 0xc0, 0x1e, 0x00, 0x00, 0x0f, 0xff, 0xe0, 0x3c, 0x00, 0x80, 0x1f, 0xef, 0xf0,
  0x78, 0x00, 0xc0, 0x3f, 0xc7, 0xf8, 0xf8, 0x00, 0xe0, 0x7f, 0x83, 0xf9, 0xf0, 0x00, 0xf0, 0x7f,
  0x01, 0xff, 0xe0, 0x00, 0xf8, 0xfe, 0x00, 0xff, 0xc0, 0x00, 0xfd, 0xfc, 0x00, 0x7f, 0xc0, 0x00,
  0xff, 0xf8, 0x00, 0x3f, 0x80, 0x00, 0xff, 0xf0, 0x00, 0x1f, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x0e,
  0x00, 0x00, 0xff, 0xc0, 0x00, 0x06, 0x00, 0x00, 0xff, 0xe0, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf0,
  0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfc, 0x00, 0x00, 0x00, 0x00,
  0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00
};

// Hangi coin'in gösterileceğini tutacağımız değişken
int currentAsset = 0; //dizinin kaçıncı elemanı
// Dizide kaç tane eleman olduğu bilgisini tutacak değişken
const int maxAssets = sizeof(assets) / sizeof(assets[0]);

void setup() {

  Serial.begin(115200);
pinMode(upLED, OUTPUT);                                                     //Define the LED pin outputs
pinMode(downLED, OUTPUT);
pinMode(blue, OUTPUT);
  // OLED ekranı başlatıyoruz ve herhangi bir hata varsa uyarıyoruz
  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("HATA: OLED ekran başlatılamadı"));
    while (1); //sürekli burada döner koda devam etmez
  }

  // Önce ekranı temizliyoruz
  display.clearDisplay();
  // Metin rengini beyaz yapıyoruz ki arka plan koyu yazılar açık renk olsun
  display.setTextColor(SSD1306_WHITE);
  // Bağlantı mesajı için text boyutunu en küçüğe ayarladık
  display.setTextSize(1);

  // Wifi'ye bağlanırken gereken zaman için bekletiyoruz
  for (uint8_t t = SETUP_TIME; t > 0; t--) {
    // Bağlanma durumunu serial'a yazdıralım
    Serial.printf("[SETUP] Bekleyin %d...\n", t);
    Serial.flush();
    // OLED ekrana da yazdıralım
    display.clearDisplay();
    display.setCursor(0, display.height() / 4);
    display.print(F("Basliyor bekleyin . . . "));
    display.print(t);
    display.display();
    delay(1000);
  }

  // Kodun geri kalan kısmı için font boyutunu 2 olarak kullanalım
  display.setTextSize(2);

  // Ağa bağlanalım
  WiFi.mode(WIFI_STA);
  WiFi.begin(WIFI_SSID, WIFI_PASS);
}

void loop() {
  // Ağa bağlanılana kadar bekliyoruz
  if ((WiFi.status() == WL_CONNECTED)) {

    // fingerprinti ayarlıyoruz
    uint8_t fingerprint[20];
    // C dilinde bir dizi diğer diziye memcopy ile atanabilir.
    memcpy(fingerprint, fingerprint_crypto, 20);

    // Bir Https istemcisi başlatalım //bu kısım olmadan SSL sertifikalı sitelerden veri çekemeyiz.
    std::unique_ptr<BearSSL::WiFiClientSecure>client(new BearSSL::WiFiClientSecure);
    client->setFingerprint(fingerprint);
    HTTPClient https;

    // API'ya bağlantı kuralım
    Serial.print("HTTPS başlatılıyor...\n");
    if (https.begin(*client, assets[currentAsset].url)) {  // HTTPS

      // Bağlantıyı başlatalım ve GET header'ını gönderelim.
      Serial.print("HTTPS GET...\n");
      int httpCode = https.GET();

      // bir hata olmuşsa httpCode değeri negatif dönecektir.
      if (httpCode > 0) {
        // Sunucudan gelen cevabı işlemeliyiz.
        Serial.printf("HTTPS GET... code: %d\n", httpCode);

        // HTTP iletişi geçerli ise gelen veriyi alıp işleyelim
        if (httpCode == HTTP_CODE_OK || httpCode == HTTP_CODE_MOVED_PERMANENTLY) {
          // API'den aldığımız veri bloğunu bir String'e atıyoruz.
          String payload = https.getString();
          // Coin'in değerini, değer değişimini alıyor ve bunlardan da %değişimi hesaplıyoruz
          float price;
          float change;
          String nick = "";

          Serial.println("Güncel veriler alındı");
          const size_t capacity = JSON_OBJECT_SIZE(4) + JSON_OBJECT_SIZE(5) + 150;
          DynamicJsonBuffer jsonBuffer(capacity);
          JsonObject& root = jsonBuffer.parseObject(payload);

          if (!root.success()) {
            Serial.println(F("Parsing başarısız!"));
            return;
          }

          Serial.println(F("Cevap:"));
          Serial.println(root["ticker"]["price"].as<char*>());
          price = root["ticker"]["price"];
          nick = root["ticker"]["base"].as<char*>();
          change = root["ticker"]["change"];

          //price = payload.substring(payload.indexOf("price") + 8, payload.indexOf("volume") - 3).toFloat();
          //change = payload.substring(payload.indexOf("change") + 9, payload.indexOf("timestamp") - 4).toFloat();
          //nick = payload.substring(payload.indexOf("base") + 7, payload.indexOf("target") - 3);

          float changePercent = change / price * 100;

          // Aldığımız veri bloğunu serial ekrana yazdıralım (kontrol için)
          Serial.println(assets[currentAsset].assetName);
          Serial.println(payload);


          // Bilgileri OLED ekrana yazdıralım
          display.clearDisplay();
          logoCizdir(assets[currentAsset].logo);//logoyu çizdir
          okCizdir(change);//pozitif ise artan ok negatif ise düşen oku çizdirecek
          degerYazdir(price);//değeri yazdır
          degisimiYazdir(changePercent);//değişim yüzdesini yazdır
          display.setTextSize(1);
          isminiYazdir(nick);//değeri yazdır
          display.setTextSize(2);
          // Bir sonraki coin'i göstermek için
          currentAsset++;//sayacı bir arttırdık
          if (currentAsset >= maxAssets) { //sona geldiysek başa çevirdik
            currentAsset = 0;
          }
        }
      }
      else { //negatif bir cevap kodu dönmüşse
        // Serial ekran ve OLED ekran kullanılarak hata bildirimi yapıyoruz.
        Serial.printf("[HTTPS] GET... failed, error: %s\n", https.errorToString(httpCode).c_str());
        display.clearDisplay();
        display.setTextSize(1);
        display.setCursor(0, display.height() / 4);
        display.println(F("HTTPS GET hatasi"));
        display.print(F("Birkaç saniye içinde yeniden denenecek"));
        display.setTextSize(2);
      }

      // https bağlantısını işimiz bitince sonlandırmalıyız.
      https.end();
    }
    else {
      // API ile bağlantı sağlanamamışsa
      Serial.println("API'ya bağlanılamıyor");
      display.clearDisplay();
      display.setTextSize(1);
      display.setCursor(0, display.height() / 4);
      display.println(F("Baglanti Hatasi"));
      display.print(F("Tekrar Denenecek"));
      display.setTextSize(2);
    }
  }

  Serial.print("Bir sonraki döngü için bekleyin...\n\n");
  delay(UPDATE_TIME * 1000);
}

// OLED ekrana logoları yazdırmak için kullandığımız prosedür
void logoCizdir(const unsigned char logo []) {
  display.drawBitmap(0,
                     (display.height() + (display.height() / 4) - LOGO_YUKSEKLIK) / 2,
                     logo, LOGO_GENISLIK, LOGO_YUKSEKLIK, 1);
  display.display();
}

// Yukarı / Aşağı Trend Oklarını yazdıran prosedür
void okCizdir(float change) {//değişimin değerine bakıp aşağı / yukarı oka karar vereceğiz
  if (change >= 0) {
    display.drawBitmap(display.width() - OK_GENISLIK, display.height() - OK_YUKSEKLIK, stonks, OK_GENISLIK, OK_YUKSEKLIK, 1);
    
  }
  else {
    display.drawBitmap(display.width() - OK_GENISLIK, display.height() - OK_YUKSEKLIK, notstonks, OK_GENISLIK, OK_YUKSEKLIK, 1);
  }
  display.display();
}

// OLED ekrana coin değerini yazdırdığımız prosedür
void degerYazdir(float price) {
  char priceBuf[20];
  // Kullanılan para birimi sembolü
  char currencySymbol = '$';
  currencySymbol = CURRENCY_SYM;
  // Değer metnini şekillendirelim
  if (price < 10) {
    sprintf(priceBuf, "%c%.5f", currencySymbol, price);
  }
  else {
    sprintf(priceBuf, "%c%.3f", currencySymbol, price);
  }
  // Ekranı ortalamak için metin boyutu bilgisine ihtiyacımız var
  int16_t x1, y1;
  uint16_t w, h;
  display.getTextBounds(priceBuf, 0, 0, &x1, &y1, &w, &h);
  // Cursor'u ekranı ortalayacak pozisyona alıyoruz.
  display.setCursor((display.width() - w) / 2, 0);
  // ekrana yazdıralım.
  display.print(priceBuf);
  display.display();
}


// Değerdeki oransal değişimi yazdırdığımız prosedür
void degisimiYazdir(float change) {
  display.setCursor(LOGO_GENISLIK + 10, display.height() / 4 + 2);
  // Pozitif değişimler için + işareti ekleyelim.
  if (change >= 0) {
    display.print(F("+"));
  }
  // değişim yüzdesi 10'dan az ise bir hane ondalık ekleyelim
  if (abs(change) < 10) {
    display.print(change, 1);
  }
  else {
    display.print(change, 0);
  }
  display.print(F("%"));
  display.display();
}
void leds(float change) {
  if (change > 0) {
digitalWrite(upLED, HIGH);
digitalWrite(downLED, LOW);
digitalWrite(blue, LOW);
}
else if (change < 0) {
 digitalWrite(downLED, HIGH);
 digitalWrite(upLED, LOW);
 digitalWrite(blue, LOW);
}
else {
 digitalWrite(downLED, LOW);
 digitalWrite(upLED, LOW);
 digitalWrite(blue, HIGH);
}
  }

// COIN kısaltmasını yazdırdığımız prosedür
void isminiYazdir(String nick) {
  display.setCursor(LOGO_GENISLIK + 5, display.height() / 4 * 3);
  // Pozitif değişimler için + işareti ekleyelim.
  display.print(nick);
  display.display();
}

Don't you simply need to call your "leds" function?

1 Like

How can I call it?

Like you call any other function

1 Like

I did it bro, thank you sooo mucchhh