Working with Wemos D1 mini and koyn library

Hello guys! I’m trying to do a project using Wemos D1 mini with a microSD card shield and koyn library. I’m new to Arduino and all of this so I started with a project which is supposed to turn on and off a LED after receiving a transaction with bitcoin.

This is the code

#include <ESP8266WiFi.h>
#include "Koyn.h"
#define LED_PIN 16

BitcoinAddress myAddress("ENCODED_KEY_ADDRESS", ADDRESS_ENCODED);

void setup()
{
  WiFi.begin("YOUR_SSID", "SSID_PASSWORD");
  while (WiFi.status()  != WL_CONNECTED)
  {
    yield();
  }
  Koyn.begin();
  Koyn.onNewTransaction(&paymentCallback);
  pinMode(LED_PIN, OUTPUT);
}

void loop()
{
  if (Koyn.isSynced())
  {
    Koyn.trackAddress(&myAddress);
  }
  Koyn.run();
}

void paymentCallback(BitcoinTransaction tx)
{
  for (int j = 0; j < tx.getOutputsCount(); j++)
  {
    BitcoinAddress to;
    tx.getOutput(j, &to);
    if (to == myAddress)
    {
      digitalWrite(LED_PIN, HIGH);
      delay(1000);
      digitalWrite(LED_PIN, LOW);
      break;
    }
  }
}

It’s not so complicated but I got a few errors saying that a class is defined in multiple headers (one from koyn.h and one from esp8266wifi.h). I don’t know how to fix it and I need both of those headers in my project, which will be a bigger project than this one. Anyone knows how to fix it?

I let the error message here, in case you need it :slight_smile:

Arduino: 1.8.12 (Windows 10), Board: "LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), v2 Lower Memory, Disabled, None, Only Sketch, 921600"

In file included from C:\..\Arduino\libraries\Koyn\src/SdFat/FatLib/FatLib.h:27:0,

                from C:\..\Arduino\libraries\Koyn\src/SdFat/SdFat.h:33,

                from C:\..\Arduino\libraries\Koyn\src/Koyn.h:10,

                from C:\..\Desktop\sketch_may16a\sketch_may16a.ino:2:

C:\..\Arduino\libraries\Koyn\src/SdFat/FatLib/ArduinoFiles.h:122:7: error: redefinition of 'class fs::File'

class File : public FatFile, public Stream {

      ^

In file included from C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\ESP8266WiFi\src/CertStoreBearSSL.h:26:0,

                from C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:30,

                from C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\ESP8266WiFi\src/WiFiClientSecure.h:41,

                from C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,

                from C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

                from C:\..\Arduino\libraries\Koyn\src/Koyn.h:8,

                from C:\..\Desktop\sketch_may16a\sketch_may16a.ino:2:

C:\..\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.1\cores\esp8266/FS.h:52:7: error: previous definition of 'class fs::File'

class File : public Stream

      ^

In file included from C:\..\Arduino\libraries\Koyn\src/SdFat/FatLib/FatLib.h:29:0,

                from C:\..\Arduino\libraries\Koyn\src/SdFat/SdFat.h:33,

                from C:\..\Arduino\libraries\Koyn\src/Koyn.h:10,

                from C:\..\Desktop\sketch_may16a\sketch_may16a.ino:2:

C:\..\Arduino\libraries\Koyn\src/SdFat/FatLib/FatFileSystem.h: In member function 'fs::File FatFileSystem::open(const char*, uint8_t)':

C:\..\Arduino\libraries\Koyn\src/SdFat/FatLib/FatFileSystem.h:92:13: error: 'class fs::File' has no member named 'open'

    tmpFile.open(vwd(), path, mode);

            ^

In file included from C:\..\Arduino\libraries\Koyn\src/Koyn.h:18:0,

                from C:\..\Desktop\sketch_may16a\sketch_may16a.ino:2:

C:\..\Arduino\libraries\Koyn\src/Utils.h: In function 'bool convertFileToHexString(fs::File*, fs::File*)':

C:\..\Arduino\libraries\Koyn\src/Utils.h:76:13: error: 'class fs::File' has no member named 'isOpen'

  if(file1->isOpen()&&file2->isOpen())

            ^

C:\..\Arduino\libraries\Koyn\src/Utils.h:76:30: error: 'class fs::File' has no member named 'isOpen'

  if(file1->isOpen()&&file2->isOpen())

                             ^

C:\..\Arduino\libraries\Koyn\src/Utils.h:80:49: error: 'class fs::File' has no member named 'curPosition'

      uint32_t remainder = file1->size()-file1->curPosition();

                                                ^

exit status 1
Error compiling for board LOLIN(WEMOS) D1 R2 & mini.