. Advertisement .
..3..
. Advertisement .
..4..
When I run my program, I receive the error message:
invalid conversion from 'ArduinoJson::Internals::JsonVariantAs<char*>::type {aka const char*}' to 'char*' [-fpermissive]
Here is my program:
char* sensor = root["sensor"];
char* sensor = root["sensor"].as<char*>();
// in a function whose return type is char*
return root["sensor"].as<char*>();
Can someone tell me why this error occurs and how to fix?
The cause: The cause of this error is that you try to put these values into a
char*
Solution: Replacing
char*
byconst char*
to fix this error.