Sorry, I want to ask that if I can send Decimal(like accel x,gyro x) by the ble characteristic to the nrfConnect, when I send the information, it always becomes hexadecimal
Sorry, I want to ask that if I can send Decimal(like accel x,gyro x) by the ble characteristic to the nrfConnect, when I send the information, it always becomes hexadecimal
When you say "decimal" do you really mean as a human-readable text ?
nRFConnect (on Android at least) certainly will display as text if you send it text ...
In general, it's better to send binary data - because that it more compact.
You then let the Application format that in a suitable way to present it to users ...
Remember that nRFConnect is just a development/test tool - it is not intended for end users!
As awneil states if you send text then nRF Connect will display that text. The way to do it is to use sprintf to copy the string with the value you want to display in decimal, i.e.
uint8_t data[20]; sprintf((char *)data, "Accel X: %f", acc_x);
Then pass the pointer to the data to the SD API for writting/notifying the value.
Best regards
Bjørn
Note that "special measures" are needed to use %f ...
https://devzone.nordicsemi.com/f/nordic-q-a/50243/pca10056-and-float/200512#200512
Another reason to let the app do it!
Thank you for the answer