Skip to main content
deleted 4 characters in body
Source Link
dda
  • 1.6k
  • 1
  • 12
  • 18

I would like to convert a byte *payloadbyte *payload to Stringa String, because I want to compare the content of the payloadpayload to other Stringanother String.

void mqttCallbackHandler(char *topic, byte *payload, unsigned int length) 
 {
   String payloadstr = ???
   ...
}

I would like to convert a byte *payload to String, because I want to compare the content of the payload to other String.

void mqttCallbackHandler(char *topic, byte *payload, unsigned int length) 
 {
   String payloadstr = ???
   ...
}

I would like to convert a byte *payload to a String, because I want to compare the content of payload to another String.

void mqttCallbackHandler(char *topic, byte *payload, unsigned int length) {
  String payloadstr = ???
  ...
}
Source Link
Dániel Kis
  • 175
  • 1
  • 3
  • 9

How to convert byte *payload to String

I would like to convert a byte *payload to String, because I want to compare the content of the payload to other String.

void mqttCallbackHandler(char *topic, byte *payload, unsigned int length) 
{
   String payloadstr = ???
   ...
}