Unhandled exception in callback handler using Bluetooth
-
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 givenThis is the version:
Pycom MicroPython 1.20.2.rc6 [v1.11-01f49f7] on 2020-02-28; WiPy with ESP32This 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
-
@Lloydy Same in using GPY
-
@aasodisen Add a second argument, e.g.
def char1_cb(chr, arg1=None): print(chr)This should work.
Best regards
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