• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

ESP32 BLE characteristic value datatype

Q&A Forum › Category: ESP32 › ESP32 BLE characteristic value datatype
0 Vote Up Vote Down
georgej asked 6 years ago

Hi Rui,

Thank you for the excellent course ‘Learn ESP32 with Arduino’.

My application simply requires that one ESP32 BLE server transmit a 16-bit integer to a second ESP32 BLE client. It appears from your server/client example (where you convert temperature etc to a temporary string variable) that BLE only transmits characteristic value data as ASCII chars. Is that correct, or is it possible to transmit and receive Ints and Floats directly?

Thank you.

George.

2 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello, the ESP32 BLE in Arduino IDE actually only supports char arrays (not strings) to set the values in the BLE characteristics:

char txString[8];
dtostrf(temperature, 1, 2, txString);
pCharacteristic->setValue(txString);

So, you’ll need to convert your float values or int values to a char array in order to work properly…

0 Vote Up Vote Down
georgej answered 6 years ago

Thank you.

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025
  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.