0
votes

this is my code :

//
// Copyright 2015 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// FirebaseDemo_ESP8266 is a sample that demo the different functions
// of the FirebaseArduino API.

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



// Set these to run example.
#define FIREBASE_HOST "EXAMPLE-12345.firebaseio.com"
#define FIREBASE_AUTH "secret"
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PWD"

void setup() {
  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);
}

int n = 0;

void loop() {
  // set value
  Firebase.setFloat("number", 42.0);
  // handle error
  if (Firebase.failed()) {
    Serial.print("setting /number failed:");
    Serial.println(Firebase.error());
    return;
  }
  delay(1000);

  // update value
  Firebase.setFloat("number", 43.0);
  // handle error
  if (Firebase.failed()) {
    Serial.print("setting /number failed:");
    Serial.println(Firebase.error());
    return;
  }
  delay(1000);

  // get value
  Serial.print("number: ");
  Serial.println(Firebase.getFloat("number"));
  delay(1000);

  // remove value
  Firebase.remove("number");
  delay(1000);

  // set string value
  Firebase.setString("message", "hello world");
  // handle error
  if (Firebase.failed()) {
    Serial.print("setting /message failed:");
    Serial.println(Firebase.error());
    return;
  }
  delay(1000);

  // set bool value
  Firebase.setBool("truth", false);
  // handle error
  if (Firebase.failed()) {
    Serial.print("setting /truth failed:");
    Serial.println(Firebase.error());
    return;
  }
  delay(1000);

  // append a new value to /logs
  String name = Firebase.pushInt("logs", n++);
  // handle error
  if (Firebase.failed()) {
    Serial.print("pushing /logs failed:");
    Serial.println(Firebase.error());
    return;
  }
  Serial.print("pushed: /logs/");
  Serial.println(name);
  delay(1000);
}

and this is my error:

**Arduino: 1.8.5 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 115200, 4M (3M SPIFFS)"

Build options changed, rebuilding all

In file included from C:\Users\ASUS\Documents\Arduino\libraries\FirebaseArduino\src/Firebase.h:30:0, from C:\Users\ASUS\Documents\Arduino\libraries\FirebaseArduino\src/FirebaseArduino.h:22, from C:\Users\ASUS\Documents\Arduino\libraries\firebase-arduino-master\examples\FirebaseDemo_ESP8266\FirebaseDemo_ESP8266.ino:21: C:\Users\ASUS\Documents\Arduino\libraries\FirebaseArduino\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> buffer_; ^

In file included from C:\Users\ASUS\Documents\Arduino\libraries\FirebaseArduino\src/FirebaseArduino.h:22:0, from C:\Users\ASUS\Documents\Arduino\libraries\firebase-arduino-master\examples\FirebaseDemo_ESP8266\FirebaseDemo_ESP8266.ino:21: C:\Users\ASUS\Documents\Arduino\libraries\FirebaseArduino\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> buffer_; ^

exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).**

please help me! thank you!

1
Looks like the error is telling you to upgrade to ArduinoJson 6. Did you try that?Johnny Mopp
yes i already installed 6.9.1kavindu tissera

1 Answers

0
votes

I had same issue. You have to downgrade your ArduinoJson.

For this; 1) Sketch --> Include Library --> Manage Libraries 2) In this window, write "json" to search box. You should see "ArduinoJson by Benoit Blanchon". Downgrade its version to 5.13.2 3) Close Arduino, Open again. 4) Send the code to your NodeMCU 5) Enjoy.