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

    Unhandled exception in callback handler using Bluetooth

    Scheduled Pinned Locked Moved Issues & Bugs
    3 Posts 3 Posters 127 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.
    • L Offline
      Lloydy
      last edited by

      Hi, I'm trying to send data via Bluetooth from a mobile device to my wipy board, this has been working for a while, but upon updating to the latest firmware I now get the following error when writing a value to a characteristic

      Unhandled exception in callback handler
      TypeError: function takes 1 positional arguments but 2 were given
      

      This is the version:

      Pycom MicroPython 1.20.2.rc6 [v1.11-01f49f7] on 2020-02-28; WiPy with ESP32
      

      This is the code:

      bluetooth.init()
          bluetooth.set_advertisement(name="Client_Name", service_uuid=serUUID)
          bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
          bluetooth.advertise(True)
          srv = bluetooth.service(uuid=serUUID, isprimary=True, nbr_chars=1)
          chr1 = srv.characteristic(uuid=ssidUUID, properties=Bluetooth.PROP_READ | Bluetooth.PROP_WRITE, value='None')
          chr1.callback(trigger=Bluetooth.CHAR_WRITE_EVENT, handler=char1_cb)
      

      And the callback is:

      def char1_cb(chr):
          print(chr)
      

      Thanks

      Lloyd

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        aasodisen @Lloydy
        last edited by

        @Lloydy Same in using GPY

        H 1 Reply Last reply Reply Quote 0
        • H Offline
          herr.frei @aasodisen
          last edited by

          @aasodisen Add a second argument, e.g.

          def char1_cb(chr, arg1=None):
              print(chr)
          

          This should work.

          Best regards

          1 Reply Last reply Reply Quote 0

          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