Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    BLE multiple characteristics in a service

    Scheduled Pinned Locked Moved WiPy 2&3
    blebluetoothwipycharacteristicservice
    5 Posts 3 Posters 3.9k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T Offline
      TravisT
      last edited by TravisT

      I seem to be having trouble getting more than one characteristic working inside of a BLE service. The below simple example is based on what is shown in the class documentation. There is not much more to help understand programming a BLE peripheral with Micropython on the wipy2/lopy boards.

      As mentioned in an email to support and in another post. I will be willing to pay for prompt support and resolution of this.

      Any help would be appreciated.

      https://docs.pycom.io/pycom_esp32/library/network.Bluetooth.html
      https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/bluetooth.html

      >>> from network import Bluetooth
      >>> ble = Bluetooth()
      BTDM CONTROLLER VERSION: 010101
      btip start
      copy .data from 4000d890 to 3ffae6e0, len 00001830
      set .bss 0x0 from 3ffb8000 to 3ffbff70, len 00007f70
      BTDM ROM VERSION 0101
      BD_ADDR: 24:0A:C4:00:6B:EC
      NVDS MAGIC FAILED
      RF Init OK with coex
      >>> ble.advertise(True)
      >>> ble.set_advertisement(name='bleep', service_uuid=b'1234567890123456', manufacturer_data=None, service_data=None)
      >>> serv = ble.service(uuid=b'1234567890123456', isprimary=True)
      >>> char1 = serv.characteristic(uuid=b'2234567890123456', value=1)
      >>> char2 = serv.characteristic(uuid=b'3234567890123456', value=2)
      
      J 1 Reply Last reply Reply Quote 1
      • J Offline
        jmarcelino @TravisT
        last edited by

        @TravisT said in BLE multiple characteristics in a service:

        serv = ble.service(uuid=b'1234567890123456', isprimary=True)

        You need to use the nbr_chars parameter when you create a service.
        For your example, with two characteristics, that would be:

        serv = ble.service(uuid=b'1234567890123456', isprimary=True,nbr_chars=2)

        This was added in 1.5.0.b1

        P 1 Reply Last reply Reply Quote 1
        • T Offline
          TravisT
          last edited by

          Thanks for the prompt help. This makes sense, just wish the documentation was better at describing typical use cases, especially when there is frequent firmware updates.

          1 Reply Last reply Reply Quote 0
          • P Offline
            panos29 @jmarcelino
            last edited by

            @jmarcelino Is there a maximum to how many characteristics a service can have?

            1 Reply Last reply Reply Quote 1
            • T Offline
              TravisT
              last edited by

              I know this is an old topic I started but it seems like there is even less documentation now on this topic of using the BLE device as a peripheral. It would be nice if the documentation better represented common functionality and how the functionality is intended to be used with this device.

              I tried to use those links that had reference to using the BLE device as a peripheral but the link was broken.

              1 Reply Last reply Reply Quote 4

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom