Skip to content

Commit

Permalink
Fixes BLE data printing (#7699)
Browse files Browse the repository at this point in the history
* Fixes BLE data printing

BLE data has no '\0' terminator, therefore it can't be printed as a regular C string.
This fix just prints the BLE data based on its length.

* Simplify printing to a single call
  • Loading branch information
SuGlider authored and me-no-dev committed Feb 7, 2023
1 parent 279d719 commit b965a8a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libraries/BLE/examples/BLE_client/BLE_client.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ static void notifyCallback(
Serial.print(" of data length ");
Serial.println(length);
Serial.print("data: ");
Serial.println((char*)pData);
Serial.write(pData, length);
Serial.println();
}

class MyClientCallback : public BLEClientCallbacks {
Expand Down

0 comments on commit b965a8a

Please sign in to comment.