}
}
When i write
DeserializationError error = deserializeJson(doc, message);
for json parse , I can't read transmitter message.I am reading transmiter message (533654 with reverse question mark or garbages) but i need to add this i guess for json parse so how can i add this correctly ? Does anyone know why its give me garbages when i add this DeserializationError error = deserializeJson(doc, message); code.
Any help will be appreciated. Thanks.
Your ESP's RX-pin Is not 5v Tolerant ! , so far so good, but time may change that.
About your question, i am not that familiar with Json at all, but i suspect a memory issue
unsigned char rxBuf[512];
Though never used and therefore probably not compiled, that is quite a chunk of memory (a quarter) to just give up. Combined with the Serial Rx & Tx buffers, and the use of the 'String' class for reception, that may be a cause.
String message = Serial.readString();
how many bytes are going to be in 'message' ?
DynamicJsonDocument doc(capacity);
And that is declared on the heap ?
I think it would be better to just send the data that you actually want, back to the UNO, and let the ESP do a bit more work.
when i run it again on serial port i saw "49587465⸮"i can't see "49587465" don't know why.When i wirte this code closing this // DeserializationError error = deserializeJson(doc, message); i can see "07413943" clearly.
Well yes, eh, to cast to a char* and then turn that into a String is silly, even if it is only so you can easily add it to other Strings (which might as well have been char* from the start). It is still using the String class, which is not very efficient, but i am happy it works now.