This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

pc-ble-driver-py example of writing a characteristic.

I'm using the pc-ble-driver-py: Standard Heart Rate example to read a characteristic just fine.

My issue is i now need to write a to a characteristic.

How would I do that given the example above that reads great but can hypothetically write to the same characteristic read?

Link to HR example:

github.com/.../heart_rate_collector.py

  • The hearth rate device doesn't contain any characteristics that you can write to. Perhaps you can try to modify the heart_rate_collector.py to connect to a device running the ble_app_uart example instead. You should see that this device has two characteristics. One that you can only enable subscriptions on (notifications, just like you do on the battery service in the heart rate example), and another that you can write to. Please check it out without pc-ble-driver-py (connect to it with your phone using the nRF Connect for iOS/Android app) to see how the example is working.

    Best regards,

    Edvin

  • Hi Edvin,

    Can you send me link to example?

    Is that on Github?

  • We don't have any examples for pc ble driver py for the ble_app_uart example. 

    I don't know if you are aware, but we have an SDK found here

    You can also use nRF Connect for Desktop or nRF Connect for iOS/android to connect to devices via BLE, to see what they look like before you start to write your pc-ble-driver-py application.

    The pc-ble-driver-py is a subset of pc-ble-driver, which is a C-based tool. I am not experienced with Python, and I don't know if you are.

    Do you intend to write a tool that is supposed to run on a PC? The reason I ask is that I am not sure whether you are using pc-ble-driver-py intentionally, or if this was the first thing you stumbled upon.

    The hex file for the ble_app_uart examples is found in the SDK from the link, which you have to unzip, and then find the example in SDK\examples\ble_peripheral\ble_app_uart. You can compile and download the hex file using SES (Segger Embedded Studio).

    BR,

    Edvin

  • I do write in python.  Its pretty obvious as my first post.  Your port of pc-ble-driver to pc-ble-driver-py is more or less there. 

    I do use the SDK and nRF Connect to send and write characteristics which works just fine.

    If you are implying that I need to look at examples in pc-ble-driver to help that's fine too.  I just wanted to know if you had an already working example in python that just demonstrated writing a characteristic.  But you do not.

    I already have a working example writing characteristic in python after some investigation and testing and I believe this ticket is closed.

  • I am in the position you were in: wanting to write a characteristic. Can you pass on any examples, tips, or links to information that helped you?

    Thanks,
    Chris

Related