BLE Second characteristic showing up NULL



  • I have the following code, the first characteristics works, the second show up as NULL. I can read the second characteristic using chr2.read(), but oever the air the characteristic shows null.

    chr1 is operating properly.

    srv1 = bluetooth.service(uuid=b'1234567890123456', nbr_chars=2, isprimary=True,)
    chr1 = srv1.characteristic(uuid=b'ab34567890123456', value=5)
    chr2 = srv1.characteristic(uuid=b'ab34567890123457', value=6)
    
    def char1_cb_handler(chr):
        events = chr.events()
        if  events & Bluetooth.CHAR_WRITE_EVENT:
            print("Char 1 write request with value = {}".format(chr.value()))
        else:
            print('Read request on char 1')
    
    
    def char2_cb_handler(chr):
        events = chr.events()
        if  events & Bluetooth.CHAR_WRITE_EVENT:
            print("Char 2 write request with value = {}".format(chr.value()))
        else:
            print('Read request on char 2')
    
    
    char1_cb = chr1.callback(trigger=Bluetooth.CHAR_WRITE_EVENT | Bluetooth.CHAR_READ_EVENT, handler=char1_cb_handler)
    char2_cb = chr2.callback(trigger=Bluetooth.CHAR_WRITE_EVENT | Bluetooth.CHAR_READ_EVENT, handler=char2_cb_handler)
    
    


  • After updating to the newest revision and resetting everything, the above code is functional. SOLVED


 

Pycom on Twitter