Go Down

Topic: Issues with ESP8266 Servo library and IFTTTMaker library (Read 842 times) previous topic - next topic

JonesyWolf

Hello all,
I was returning to a (formerly working) IoT project today after waiting many months for a micro servo from China to reach me. Now, a problem has arisen: my code (see attached) no longer compiles even though I haven't modified since I successfully uploaded the code 3 months ago (my hardware setup still works!). It uses a NodeMCU module, a micro servo and an ultrasonic sensor.

Attachedis my code (x, y and z hide sensitive information):

Here are the compilation errors:
Code: [Select]

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp: In member function 'String IFTTTMaker::sendTriggerEventWithData(String, ArduinoJson::JsonObject&)':

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:76:26: error: 'class ArduinoJson::JsonObject' has no member named 'measureLength'

     int length = payload.measureLength();

                          ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:82:13: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'

     payload.printTo(out);

             ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp: In member function 'bool IFTTTMaker::triggerEvent(String, String, String, String)':

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:3: error: 'DynamicJsonBuffer' was not declared in this scope

   DynamicJsonBuffer jsonBuffer;

   ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:3: note: suggested alternative:

In file included from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,

                 from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,

                 from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,

                 from C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.h:24,

                 from C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:20:

C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note:   'ArduinoJson::Internals::DynamicJsonBuffer'

     DynamicJsonBuffer;

     ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:21: error: expected ';' before 'jsonBuffer'

   DynamicJsonBuffer jsonBuffer;

                     ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:106:25: error: 'jsonBuffer' was not declared in this scope

   JsonObject& payload = jsonBuffer.createObject();

                         ^

Multiple libraries were found for "Servo.h"
 Used: C:\Users\John\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.4.1\libraries\Servo
 Not used: C:\Program Files (x86)\Arduino\libraries\Servo
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).


Here is a link to the IFTTTMaker library's TriggerEvent example that also no longer compiles


Here are the example's compilation errors:
Code: [Select]

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp: In member function 'String IFTTTMaker::sendTriggerEventWithData(String, ArduinoJson::JsonObject&)':

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:76:26: error: 'class ArduinoJson::JsonObject' has no member named 'measureLength'

     int length = payload.measureLength();

                          ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:82:13: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'

     payload.printTo(out);

             ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp: In member function 'bool IFTTTMaker::triggerEvent(String, String, String, String)':

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:3: error: 'DynamicJsonBuffer' was not declared in this scope

   DynamicJsonBuffer jsonBuffer;

   ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:3: note: suggested alternative:

In file included from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/DynamicJsonDocument.hpp:10:0,

                 from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.hpp:9,

                 from C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson.h:9,

                 from C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.h:24,

                 from C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:20:

C:\Users\John\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Memory/DynamicJsonBuffer.hpp:159:5: note:   'ArduinoJson::Internals::DynamicJsonBuffer'

     DynamicJsonBuffer;

     ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:105:21: error: expected ';' before 'jsonBuffer'

   DynamicJsonBuffer jsonBuffer;

                     ^

C:\Users\John\Documents\Arduino\libraries\arduino-ifttt-maker-master\src\IFTTTMaker.cpp:106:25: error: 'jsonBuffer' was not declared in this scope

   JsonObject& payload = jsonBuffer.createObject();

                         ^

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



Lastly, here is a link to the IFTTTMaker library and the ArduinoJson library.

My hypothesis is that the ArduinoJson has been updated since I used it and has become incompatible, however I do not remember which version worked initially.

Any help would be appreciated,
John



pert

My hypothesis is that the ArduinoJson has been updated since I used it and has become incompatible,
I concur:
https://arduinojson.org/v5/faq/error-jsonbuffer-was-not-declared-in-this-scope/

however I do not remember which version worked initially.
It's easy enough to roll back through versions until you find the right one (likely 5.13.2):
  • Sketch > Include Library > Manage Libraries
  • Wait for download to finish.
  • In the "Filter your search..." box, type "arduinojson".
  • Click on "ArduinoJson by Benoit Blanchon".
  • Select a version from the dropdown menu.
  • Click "Install".
  • Wait for the installation to finish.
  • Click "Close".
  • Try compiling again.
  • Repeat until you find the right version.

JonesyWolf

Hi pert,
Thank you for your prompt reply, I downgraded the library to version 5.13.2 as per your instructions and everything compiled correctly. Problem solved!
Thank you for your solution,
John

Go Up