ArduinoJson Serializer

Hi,

I would like to use ArduinoJson to serialize my sensor data before publishing it via mqtt. Unfortunatlex it seems like ArduinoJson and the D21G board package are not compatible?

Is there a way of making them compatible?

Help is highly appreciated!

Error message:

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Industruino D21G"

In file included from C:\...\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Numbers/FloatTraits.hpp:13:0, C:\...\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Numbers/convertNumber.hpp:15,

....

C:\....\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp: In instantiation of 'const T* ArduinoJson::V704PB2::detail::pgm_read(const T* const*) [with T = char]':

C:\....\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Deserialization/DeserializationError.hpp:85:42:   required from here

C:\....\Documents\Arduino\libraries\ArduinoJson\src/ArduinoJson/Polyfills/pgmspace_generic.hpp:25:52: error: 'const void*' is not a pointer-to-object type

   return reinterpret_cast<const T*>(pgm_read_ptr(p));                                           ^

exit status 1

Error compiling for board Industruino D21G.

 

Eric Bochert
Eric Bochert
24
| 0 0 0
Asked on 4/29/24, 10:52 AM
0
vote
488 Views

Apperently this is not an Industruino specific error but a SAMD21 specific error. 

The solution is this:

#define ARDUINOJSON_ENABLE_PROGMEM 0
#include <ArduinoJson.h>

Hope this will save somebody else some time saerching.

Eric Bochert
Eric Bochert
24
| 0 0 0
Answered on 4/29/24, 2:18 PM
1
vote

Your answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

Ask a Question

Keep Informed

About This Forum

This community is for professionals and enthusiasts of our products and services.

Read Guidelines

Question tools

68 follower(s)

Stats

Asked: 4/29/24, 10:52 AM
Seen: 488 times
Last updated: 4/29/24, 2:18 PM