0
votes

All,

I have working on a project with my Adafruit Feather Huzzuh.

I am working my way through the following tutorial.

https://docs.microsoft.com/nl-nl/azure/iot-hub/iot-hub-arduino-huzzah-esp8266-get-started

Still using Arduino IDE by the way.

The board and the DHT sensor have worked before.

I believe that all packages are installed.

I use the opensource code from:

https://github.com/Azure-Samples/iot-hub-feather-huzzah-client-app.git

I get a compiler error when I try to compile the main app.ino file (https://github.com/Azure-Samples/iot-hub-feather-huzzah-client-app/blob/master/app/app.ino).

The error is:

Arduino: 1.8.5 (Windows 10), Board: "Adafruit Feather HUZZAH ESP8266, 80 MHz, Flash, 4M (3M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino: In function 'bool readMessage(int, char*)':

message:46: error: 'StaticJsonBuffer' was not declared in this scope

 StaticJsonBuffer<MESSAGE_MAX_LEN> jsonBuffer;

 ^

C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino:46:5: note: suggested alternative:

In file included from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson/StaticJsonDocument.hpp:8:0,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson.hpp:10,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson.h:9,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino:2:

C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson/Memory/StaticJsonBuffer.hpp:110:7: note: 'ArduinoJson::Internals::StaticJsonBuffer'

class StaticJsonBuffer : public Internals::StaticJsonBufferBase {

   ^

message:46: error: 'jsonBuffer' was not declared in this scope

 StaticJsonBuffer<MESSAGE_MAX_LEN> jsonBuffer;

                                   ^

message:74: error: 'class ArduinoJson::JsonObject' has no member named 'printTo'

 root.printTo(payload, MESSAGE_MAX_LEN);

      ^

C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino: In function 'void parseTwinMessage(char*)':

message:80: error: 'StaticJsonBuffer' was not declared in this scope

 StaticJsonBuffer<MESSAGE_MAX_LEN> jsonBuffer;

 ^

C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino:80:5: note: suggested alternative:

In file included from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson/StaticJsonDocument.hpp:8:0,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson.hpp:10,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson.h:9,

             from C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino:2:

C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson/Memory/StaticJsonBuffer.hpp:110:7: note: 'ArduinoJson::Internals::StaticJsonBuffer'

class StaticJsonBuffer : public Internals::StaticJsonBufferBase {

   ^

message:80: error: 'jsonBuffer' was not declared in this scope

 StaticJsonBuffer<MESSAGE_MAX_LEN> jsonBuffer;

                                   ^

message:82: error: 'class ArduinoJson::JsonObject' has no member named 'success'

 if (!root.success())

           ^

message:88: error: 'ArduinoJson::Internals::enable_if >::type' has no member named 'success'

 if (root["desired"]["interval"].success())

                                 ^

exit status 1 'StaticJsonBuffer' was not declared in this scope

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

the ArduinoJson.h file is included in the message.ino file.

Is the opensource code supplied by MSFT broken?

Anyone an idea to fix this?

EDIT 2018-08-23

The answer from Rita Han - MSFT worked (rollingback the json libary to version 5.x) and I can see now that the device it connected to my access point. I have run into the following problem:

connected with NETGEAR33, channel 10 dhcp client start... ip:192.168.1.29,mask:255.255.255.0,gw:192.168.1.1 Connected to wifi NETGEAR33. Fetched NTP epoch time is: 28821. deviceId is not found Failed on IoTHubClient_CreateFromConnectionString.

I copied the "Connection string - primary key" from the iothubowner menu under settings: shared access policies.

Somehow it does not accept my shared access key. I will google a bit to try and solve this. Help is appreciated.

EDIT 2018-08-03 Solved as well !! I see the measurements in the serial monitor. Need to find a way to change it from DH22 to DH11... but should be able to figure that one out myself. Have seen and fixed the issue on my Adafruit IO try as well.

1
Hi borreltijd, I saw similar issue before. You can check my answer to see if it helps.Rita Han
Great it worked!borreltijd
Hi borreltijd, glad to hear that. If the answer help you solved the issue you can accept it as the answer. Thanks.Rita Han

1 Answers

2
votes

The reason for this error is that you install the ArduinoJson version >= 6. Default version 6.2.3-beta will be installed but from version 6 and higher JsonBuffer is replaced with JsonDocument. It is also indicate in the error message:

C:\Users\edwin\Dropbox\Projects\Arduino project\DHT_online_azure\app\message.ino:80:5: note: suggested alternative:

In file included from C:\Users\edwin\Dropbox\Projects\Arduino project\libraries\arduino_163901\src/ArduinoJson/StaticJsonDocument.hpp:8:0,

To solve this issue you can roll back to the previous version. Version 5.13.2 works for me.