Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Hello there I hope everyone is safe and healthy

I have this error message while trying to verify/compile a certain sensor I work in

(Error compiling for board NodeMCU 1.0 (ESP-12E Module).))

This is my code

const int  trigPin = 2;
const int echoPin = 0;
const int ledPin = 12;
long duration;
int distance;
int safetyDistance;

#include <ESP8266WiFi.h>
#include <FirebaseArduino.h>

// Set these to run example.


void setup() {
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);

  // connect to wifi.
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  Serial.print("connecting"); 
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println();
  Serial.print("connected: ");
  Serial.println(WiFi.localIP());
  
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
 
}
 
void loop() {
 
  digitalWrite(trigPin, LOW);  
  delayMicroseconds(2); 
  
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);  
  digitalWrite(trigPin, LOW);
  
  duration = pulseIn(echoPin, HIGH);
  distance = duration * 0.34 / 2;
  
  Serial.print("Distance:");
  Serial.print(distance);
  
safetyDistance = distance;
if (safetyDistance <= 5){
  digitalWrite(ledPin, HIGH);
}
else{
  digitalWrite(ledPin, LOW);
}

 //handle error
 if (Firebase.failed()){
  Serial.print("setting failed");
  Serial.println(Firebase.error());
  return;
 }
 delay(1000);
}

I am using v3 ES[8266 WIFI attached to a board because I am working on a sensor as well, this is a picture of my entire board, it's also attached.

Greetings

board.png

board.png

Please edit your post to remove your firebase and wifi credentials in the code.

david_2018:
Please edit your post to remove your firebase and wifi credentials in the code.

Thank your for the advice, hope I get to find an answer

If I have found the same library you are using, the follow errors occur, which would indicate the library needs to be updated.

In file included from /home/pi/Arduino/libraries/firebase-arduino-master/src/Firebase.h:30:0,
                 from /home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseArduino.h:22,
                 from /home/pi/Arduino/forumTest/forumTest.ino:11:
/home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseObject.h:109: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
     std::shared_ptr<StaticJsonBuffer<FIREBASE_JSONBUFFER_SIZE>> buffer_;
           ^
In file included from /home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseArduino.h:22:0,
                 from /home/pi/Arduino/forumTest/forumTest.ino:11:
/home/pi/Arduino/libraries/firebase-arduino-master/src/Firebase.h:86: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
   std::shared_ptr<StaticJsonBuffer<FIREBASE_JSONBUFFER_SIZE>> buffer_;
           ^

You will need to post the actual error message to get a better response.

As for your code, it is best to change the credentials to something that will allow the code to still compile, instead of removing the lines entirely. As an example:

// Set these to run example.
#define FIREBASE_HOST "removed"
#define FIREBASE_AUTH "removed"
#define WIFI_SSID "removed"
#define WIFI_PASSWORD "removed"

mohammedsamih:
I have this error message while trying to verify/compile a certain sensor I work in

(Error compiling for board NodeMCU 1.0 (ESP-12E Module).))

That is just the generic error message that only tells us something went wrong. There are an infinite number of possible causes. You need to scroll up in the black console pane at the bottom of the Arduino IDE window to see the specific error message that will provide useful information about the cause of the compilation failure. You'll be much more likely to get effective help here if you make the effort to provide the information we need.

david_2018:

/home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseObject.h:109: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

@mohammedsamih if this is actually the error message you're getting (notice how we have to play guessing games when you don't provide enough information?), this error means you're using a version of ArduinoJson library that is not compatible with the Firebase library's code. 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.5".
  • 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:

david_2018:
If I have found the same library you are using, the follow errors occur, which would indicate the library needs to be updated.

In file included from /home/pi/Arduino/libraries/firebase-arduino-master/src/Firebase.h:30:0,

from /home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseArduino.h:22,
                from /home/pi/Arduino/forumTest/forumTest.ino:11:
/home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseObject.h:109: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
    std::shared_ptr<StaticJsonBuffer<FIREBASE_JSONBUFFER_SIZE>> buffer_;
          ^
In file included from /home/pi/Arduino/libraries/firebase-arduino-master/src/FirebaseArduino.h:22:0,
                from /home/pi/Arduino/forumTest/forumTest.ino:11:
/home/pi/Arduino/libraries/firebase-arduino-master/src/Firebase.h:86: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
  std::shared_ptr<StaticJsonBuffer<FIREBASE_JSONBUFFER_SIZE>> buffer_;
          ^




You will need to post the actual error message to get a better response.

As for your code, it is best to change the credentials to something that will allow the code to still compile, instead of removing the lines entirely. As an example:


// Set these to run example.
#define FIREBASE_HOST “removed”
#define FIREBASE_AUTH “removed”
#define WIFI_SSID “removed”
#define WIFI_PASSWORD “removed”

Thank you very much for replying, I am about to edit the code as you mentioned,
Secondly, I just started using Arduino hence I am not too familiar with the terminologies, however I do think I updated all the libraries beforehand.

pert:
That is just the generic error message that only tells us something went wrong. There are an infinite number of possible causes. You need to scroll up in the black console pane at the bottom of the Arduino IDE window to see the specific error message that will provide useful information about the cause of the compilation failure. You'll be much more likely to get effective help here if you make the effort to provide the information we need.@mohammedsamih if this is actually the error message you're getting (notice how we have to play guessing games when you don't provide enough information?), this error means you're using a version of ArduinoJson library that is not compatible with the Firebase library's code. 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.5".
  • 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:
Migrating from version 5 to 6 | ArduinoJson 6

Reference:
Redirecting…

Thank you very much for replying,
I would like to firstly apologize for the lack of proper question, I will work on editing the code based on your instruction + the question as well and I highly appreciate your effort.

Apparently the issue was solved based on your solution, I really thank you for this,

You're welcome. I'm glad to hear it's working now. Enjoy!
Per