Hi i need help with my coding, there is some issues with the TelegramBot.h library it keeps having an error. These are my codes and errors that occurred. URGENT
#include <ESP8266WiFi.h>
#include <WiFiClientSecure.h>
#include <TelegramBot.h>
#define LED 1 //led pin number
// Initialize Wifi connection to the router
const char* ssid = "xxxxx";
const char* password = "yyyyy";
// Initialize Telegram BOT
const char BotToken[] = "xxxxxxxxx";
WiFiClientSecure net_ssl;
TelegramBot bot (BotToken, net_ssl);
// the number of the LED pin
void setup()
{
Serial.begin(115200);
while (!Serial) {} //Start running when the serial is open
delay(3000);
// attempt to connect to Wifi network:
Serial.print("Connecting Wifi: ");
Serial.println(ssid);
while (WiFi.begin(ssid, password) != WL_CONNECTED)
{
Serial.print(".");
delay(500);
}
Serial.println("");
Serial.println("WiFi connected");
bot.begin();
pinMode(LED, OUTPUT);
}
void loop()
{
message m = bot.getUpdates(); // Read new messages
if (m.text.equals("on"))
{
digitalWrite(LED, 1);
bot.sendMessage(m.chat_id, "The Led is now ON");
}
else if (m.text.equals("off"))
{
digitalWrite(LED, 0);
bot.sendMessage(m.chat_id, "The Led is now OFF");
}
}
These are the errors that occurred:
C:\Users\165298B\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp: In member function 'message TelegramBot::getUpdates()':
C:\Users\165298B\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:39:4: error: 'StaticJsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:39:37: error: 'jsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:44:12: error: 'class ArduinoJson650_0_0::JsonObject' has no member named 'success'
if(root.success()){
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp: In member function 'String TelegramBot::sendMessage(String, String)':
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:87:3: error: 'StaticJsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:87:36: error: 'jsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:93:8: error: 'class ArduinoJson650_0_0::JsonObject' has no member named 'printTo'
buff.printTo(msg);
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp: In member function 'String TelegramBot::sendMessage(String, String, TelegramKeyboard&, bool, bool)':
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:102:3: error: 'StaticJsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:102:36: error: 'jsonBuffer' was not declared in this scope
StaticJsonBuffer<JSON_BUFF_SIZE> jsonBuffer;
^
C:\Users\165298B\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:107:68: error: invalid initialization of non-const reference of type 'ArduinoJson650_0_0::JsonObject&' from an rvalue of type 'ArduinoJson650_0_0::JsonObject'
JsonObject& reply_markup = buff.createNestedObject("reply_markup");
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:108:66: error: invalid initialization of non-const reference of type 'ArduinoJson650_0_0::JsonArray&' from an rvalue of type 'ArduinoJson650_0_0::JsonArray'
JsonArray& keyboard = reply_markup.createNestedArray("keyboard");
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:111:48: error: invalid initialization of non-const reference of type 'ArduinoJson650_0_0::JsonArray&' from an rvalue of type 'ArduinoJson650_0_0::JsonArray'
JsonArray& row = keyboard.createNestedArray();
^
C:\Users\Documents\Arduino\libraries\TelegramBot\src\TelegramBot.cpp:122:8: error: 'class ArduinoJson650_0_0::JsonObject' has no member named 'printTo'
buff.printTo(msg);
^
exit status 1
Error compiling for board Generic ESP8266 Module.