Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 436 Bytes

5.-Troubleshooting.md

File metadata and controls

11 lines (8 loc) · 436 Bytes

Troubleshooting

  • The payload of incoming messages contains raw data. You cannot just print out the data without formatting. This is because Arduino's print functions expect a C-string as input and a MQTT payload is not. A simple solution is to print each character of the payload:
for (size_t i = 0; i < len; ++i) {
    Serial.print(payload[i]);
}

Further reading: https://en.wikipedia.org/wiki/C_string_handling