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

    LoPy to LoPY BLE example problems

    Scheduled Pinned Locked Moved Discussion
    ble
    1 Posts 1 Posters 23 Views 1 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.
    • A Offline
      Alexander Johansson
      last edited by

      Hi!
      I'm fairly new to working with BLE but have been trying to follow and use the examples given to understand how to get it working. As I understand it, the LoPy (or other Pycom moduels supporting BLE) can act as both a client and a server.
      And by following/copying the BLE callback example with one LoPy as the Client and another LoPy as the Server they should be able to exchange information.

      By just copy pasting the code and flashing it on to the LoPy's I get them to connect but when the client tries to find the characteristic within the services it can never find the correct uuid (one equal to 0xec0e) for the charactersistic. Part of code I'm talking about:

      #more code below this see link to example
            for service in services:
                  chars = service.characteristics()
                  for char in chars:                    
                          c_uuid = char.uuid()
                          if c_uuid == 0xec0e:
                              if (char.properties() & Bluetooth.PROP_NOTIFY):
                                  char.callback(trigger=Bluetooth.CHAR_NOTIFY_EVENT, handler=char_notify_callback)
                                  print(c_uuid)
                                  break
      #more code below this see link to example
      

      When actually printing the c_uuid it always gives me the integers:

      • 10757
      • 10752
      • 10753
      • 10918

      None of these equal to the value of 60430 (0xec0e) and the if statement will never become true. So how should I compare the values or convert the values for them to be comparable?

      Is there some conversion missing in the example or have I just missunderstood the examples?

      Thanks in advannce //Alex

      1 Reply Last reply Reply Quote 1

      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