This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to printf to BLE Central (iPhone)

Unfortunately it is only ever explained here how printf is possible via UART. I wonder how printf is possible over BLE. I would like to send messages (strings) with numerical values to a logging app on the phone (and commands from the phone to the BLE device for execution, e.g. changing config data).

So how would I use printf to embed the numbers into strings and send them using the nus service? (without having to reinvent the wheel).

Parents
  • Hi Karl,

    thanks for your response!

    Yes, the nus service does not seem to be a problem. I have already tested that (with App_uart).

    But I would have to recode the printf function. How else should I embed numerical values, e.g. "speed(kmh)=%d" or "battery voltage=%d V" etc.?

    Where can I find documentation on the supported standard string functions? Is there a sprintf?

    Somehow I have to convert numbers to strings. (That's what I mean by "having to reinvent the wheel". That would be sad).

Reply
  • Hi Karl,

    thanks for your response!

    Yes, the nus service does not seem to be a problem. I have already tested that (with App_uart).

    But I would have to recode the printf function. How else should I embed numerical values, e.g. "speed(kmh)=%d" or "battery voltage=%d V" etc.?

    Where can I find documentation on the supported standard string functions? Is there a sprintf?

    Somehow I have to convert numbers to strings. (That's what I mean by "having to reinvent the wheel". That would be sad).

Children
Related