i have done ble_app_template writing values from nrf app connect, in that i have send only integer values from nrf app connect
now i want to write float values from nrf app and flaot values have to print
which part of the code i have to change
i have done ble_app_template writing values from nrf app connect, in that i have send only integer values from nrf app connect
now i want to write float values from nrf app and flaot values have to print
which part of the code i have to change
Bluetooth Low Energy only transmits a uint8_t byte array. However, you can convert the the float into ASCII chars and then transmit that. It should display as text in the nRF Connect app.
double temp = read_temperature(); // Place the temperature measurement into the data array uint32_t err_code; uint8_t data[20]; sprintf((char *)data, "Temperature: %f", temp); // Pass the data array to sd_ble_gatts_hvx() to send it to the connected central.
Best regards
Bjørn
Bjorn thank you!
i'm trying to give float values from the nRF connect app, the ble app template has to take that value and those input values has to print on debugger. how can i take those float values
It will be the same in that direction as well. You can only send a byte array, so you can send the float as ascii chars and then print it on the nRF side. I recommend that you take a look a the ble_app_uart example. It does exactly this!
It will be the same in that direction as well. You can only send a byte array, so you can send the float as ascii chars and then print it on the nRF side. I recommend that you take a look a the ble_app_uart example. It does exactly this!