Skip to main content
Associate II
September 11, 2024
Question

How to display characteristic value as a float in stm32 toolbox app?

  • September 11, 2024
  • 3 replies
  • 1186 views

I have a program that updates a ble characteristic where it gets displayed on the stm32 toolbox app as however many bytes I set it to in Stm32CubeMX. This which makes sense in terms of default configurations, but if I wanted to display a float value instead how would I go about that?

For reference im using Custom_STM_App_Update_Char() to updating the value where If I pass in a float it gets converted to bytes automatically.

3 replies

STTwo-32
Technical Moderator
September 12, 2024

Hello @Hichamm 

Could you please clarify your needs. 

Best Regards.

STTwo-32

 

HichammAuthor
Associate II
September 12, 2024

I have a custom BLE service with a characteristic being continuously updated by my program. This characteristic value is displayed on apps such as ST BLE Toolbox and Nrf Connect where I can see the value changing every time it gets updated, but it is displayed as bytes. This makes sense as Custom_STM_App_Update_Char() uses an array of bytes as a parameter rather than a float but I want to see the data displayed as a float value instead.


STTwo-32
Technical Moderator
September 17, 2024

Hello @Hichamm 

I don't think it is as easy as you said. Maybe a good way is to prepare your data and decode it on an array of bytes, send this array and on the reception, re-built the float from the received data (using a secondary application or something else). 

Best Regards.

STTwo-32

HichammAuthor
Associate II
September 16, 2024

@STTwo-32 any ideas on how to achieve this?