Error Compiling Exit 1

Hi guys, I want to ask. I just wrote a code and it didn't success compiling, and it's say multiple library were found and i don't included to the code. Is there wrong whit my code. please help!

#include "SPI.h"
#include "MFRC522.h"
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h> 
#include <TelegramBot.h> 
#define SS_PIN D4
#define RST_PIN D3
#define led1 D8
#define rel1 D1
#define rel2 D2

MFRC522 rfid(SS_PIN, RST_PIN);

MFRC522::MIFARE_Key key;
boolean pinState;
boolean RFIDMode = true;

char ssid[] = "xxxx";
char pass[] = "xxxx";

const char BotToken[] = "xxxx"; 
WiFiClientSecure net_ssl; 
TelegramBot bot (BotToken, net_ssl); 

void setup() {
  Serial.begin(9600);
    Serial.print("Connecting Wifi: ");   
Serial.println(ssid);   
while (WiFi.begin(ssid, pass) != WL_CONNECTED)  
      {   
  Serial.print(".");   
  delay(500);   
}   
Serial.println("");   
Serial.println("WiFi connected");   
bot.begin();

  SPI.begin();
  rfid.PCD_Init(); 
  int state; //adaugat
  pinMode(rel1, OUTPUT);
  pinMode(rel2, OUTPUT);
  pinMode(led1, OUTPUT);
digitalWrite(rel1, HIGH);
digitalWrite(rel2, HIGH);
digitalWrite(led1, HIGH);
}

void loop() {

if (RFIDMode == true) {
  if (!rfid.PICC_IsNewCardPresent() || !rfid.PICC_ReadCardSerial())
    return;

  // Serial.print(F("PICC type: "));
  MFRC522::PICC_Type piccType = rfid.PICC_GetType(rfid.uid.sak);
  // Serial.println(rfid.PICC_GetTypeName(piccType));

  // Check is the PICC of Classic MIFARE type
  if (piccType != MFRC522::PICC_TYPE_MIFARE_MINI &&
    piccType != MFRC522::PICC_TYPE_MIFARE_1K &&
    piccType != MFRC522::PICC_TYPE_MIFARE_4K) {
    Serial.println(F("Your tag is not of type MIFARE Classic."));
    return;
  }

  String strID = "";
  for (byte i = 0; i < 4; i++) {
    strID +=
    (rfid.uid.uidByte[i] < 0x10 ? "0" : "") +
    String(rfid.uid.uidByte[i], HEX) +
    (i!=3 ? ":" : "");
  }
  strID.toUpperCase();

  // LED 
  Serial.print("Tap card key: ");
  Serial.println(strID);


 if (strID.indexOf("F9:62:A8:98") >= 0 ||
     strID.indexOf("F9:62:A8:88") >= 0) {
          if (digitalRead(led1) == LOW) {
                digitalWrite(rel1, LOW);   
                delay(500);
                digitalWrite(rel1, HIGH);
                 digitalWrite(led1, HIGH);
           }
        //   if (digitalRead(led1) == LOW)
        else{
                digitalWrite(rel2, LOW);   
                delay(500);
                digitalWrite(rel2, HIGH);
                 digitalWrite(led1, LOW);
           }
 }
         
  rfid.PICC_HaltA();
  rfid.PCD_StopCrypto1();
}

if (RFIDMode == false) {
  message m = bot.getUpdates();
  if (m.text.equals("lock")) {
                digitalWrite(rel1, LOW);   
                delay(500);
                digitalWrite(rel1, HIGH);
                digitalWrite(led1, HIGH);
           }
        //   if (digitalRead(led1) == LOW)
  else if (m.text.equals("unlock")) {
                digitalWrite(rel2, LOW);   
                delay(500);
                digitalWrite(rel2, HIGH);
                 digitalWrite(led1, LOW);
  }
}
}

sketch_jan01b.ino (2.85 KB)

Please do this:

  • When you encounter an error, you'll see a button on the right side of the orange bar "Copy error messages" in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button..
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum's code tags markup to your reply.
  • Press "Ctrl + V". This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum's 9000 character limit, save it to a .txt file and post it as an attachment. If you click the "Reply" button here, you will see an "Attachments and other settings" link.

here the compiling error messages

Arduino: 1.8.10 (Mac OS X), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:39:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
    StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
           ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:87:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
           ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:102:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
           ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp: In member function 'message TelegramBot::getUpdates()':
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:39:20: error: expected primary-expression before '<' token
    StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:39:37: error: 'jsonBuffer' was not declared in this scope
    StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                                     ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:44:12: error: 'ArduinoJson::JsonObject' has no member named 'success'
    if(root.success()){
            ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp: In member function 'String TelegramBot::sendMessage(String, String)':
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:87:19: error: expected primary-expression before '<' token
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                   ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:87:36: error: 'jsonBuffer' was not declared in this scope
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:93:8: error: 'ArduinoJson::JsonObject' has no member named 'printTo'
   buff.printTo(msg);
        ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp: In member function 'String TelegramBot::sendMessage(String, String, TelegramKeyboard&, bool, bool)':
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:102:19: error: expected primary-expression before '<' token
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                   ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:102:36: error: 'jsonBuffer' was not declared in this scope
   StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
                                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:107:68: error: invalid initialization of non-const reference of type 'ArduinoJson::JsonObject& {aka ArduinoJson6130_000001::ObjectRef&}' from an rvalue of type 'ArduinoJson6130_000001::ObjectRef'
   JsonObject& reply_markup = buff.createNestedObject("reply_markup");
                                                                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:108:66: error: invalid initialization of non-const reference of type 'ArduinoJson::JsonArray& {aka ArduinoJson6130_000001::ArrayRef&}' from an rvalue of type 'ArduinoJson6130_000001::ArrayRef'
   JsonArray& keyboard = reply_markup.createNestedArray("keyboard");
                                                                  ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:111:48: error: invalid initialization of non-const reference of type 'ArduinoJson::JsonArray& {aka ArduinoJson6130_000001::ArrayRef&}' from an rvalue of type 'ArduinoJson6130_000001::ArrayRef'
    JsonArray& row = keyboard.createNestedArray();
                                                ^
In file included from /Users/rizkyakhbar/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/cores/esp8266/Arduino.h:29:0,
                 from /Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.h:10,
                 from /Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:8:
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:117:20: error: expected primary-expression before 'bool'
   reply_markup.set<bool>("one_time_keyboard", one_time_keyboard);
                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:117:20: error: expected ';' before 'bool'
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:118:20: error: expected primary-expression before 'bool'
   reply_markup.set<bool>("resize_keyboard", resize_keyboard);
                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:118:20: error: expected ';' before 'bool'
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:119:20: error: expected primary-expression before 'bool'
   reply_markup.set<bool>("selective", false);
                    ^
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:119:20: error: expected ';' before 'bool'
/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:122:8: error: 'ArduinoJson::JsonObject' has no member named 'printTo'
   buff.printTo(msg);
        ^
Multiple libraries were found for "SPI.h"
 Used: /Users/rizkyakhbar/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/SPI
Multiple libraries were found for "MFRC522.h"
 Used: /Users/rizkyakhbar/Documents/Arduino/libraries/MFRC522
Multiple libraries were found for "ESP8266WiFi.h"
 Used: /Users/rizkyakhbar/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/ESP8266WiFi
Multiple libraries were found for "TelegramBot.h"
 Used: /Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot
Multiple libraries were found for "ArduinoJson.h"
 Used: /Users/rizkyakhbar/Documents/Arduino/libraries/ArduinoJson
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

rizkyakhbar:

Multiple libraries were found for "SPI.h"

Used: /Users/rizkyakhbar/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/SPI
Multiple libraries were found for "MFRC522.h"
Used: /Users/rizkyakhbar/Documents/Arduino/libraries/MFRC522
Multiple libraries were found for "ESP8266WiFi.h"
Used: /Users/rizkyakhbar/Library/Arduino15/packages/esp8266/hardware/esp8266/2.5.1/libraries/ESP8266WiFi
Multiple libraries were found for "TelegramBot.h"
Used: /Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot
Multiple libraries were found for "ArduinoJson.h"
Used: /Users/rizkyakhbar/Documents/Arduino/libraries/ArduinoJson

These have absolutely nothing to do with the compilation error. It's just some helpful information the Arduino IDE provides. Actually, in this case it's not so useful because there is a bug in Arduino IDE 1.8.10 that causes it to show "Multiple libraries were found" even when no multiple libraries were found. You'll know the legitimate "Multiple libraries were found" messages because they'll show the paths to multiple libraries. Generally, you can just ignore these messages. The only time you need to pay attention to them is if a different library than the one you intended was chosen.

To see the real cause of the error, you need to scroll the black console window up:

rizkyakhbar:

/Users/rizkyakhbar/Documents/Arduino/libraries/TelegramBot/src/TelegramBot.cpp:39:11: error: StaticJsonBuffer is a class from ArduinoJson 5. Please see arduinojson.org/upgrade to learn how to upgrade your program to ArduinoJson version 6

StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;

You can see the error is quite informative. However, you might find it easier to roll back to the version of the ArduinoJson library the code was written for, rather than porting the code to the ArduinoJson 6 API.
The ArduinoJson library 6.x.x versions have breaking changes that make them not work with code written for the ArduinoJson 5.x.x versions.

The recommended solution is to roll back to the newest 5.x.x release of ArduinoJson:

  • Sketch > Include Library > Manage Libraries...
  • Wait for the download to finish.
  • In the "Filter your search..." box, type "arduinojson".
  • In the search results, click on "ArduinoJson by Benoit Blanchon"
  • From the dropdown version menu, select "5.13.4".
  • Click "Install".
  • Wait for the installation to finish.
  • Click "Close'. The code should now compile.

The alternative solution is to update the code to work with the 6.x.x versions of ArduinoJson. You will find a guide to this here:

Reference:

Oh God, I didn't realize, so the telegrambot use arduinojson v.5, thanks I appriciate for your help Pert.

You're welcome. I'm glad if I was able to be of assistance. Enjoy!
Per