#Help with registering to be notify of changes in a remote BLE characteristics

1 messages · Page 1 of 1 (latest)

junior harbor
#

I have a BLE peripheral device with a single service and a single characteristic. The characteristic holds an 8-bit uint which is set to 1 when the switch is on, 0 when the switch is off. The characteristic supports READ and NOTIFY.

#

Using nRF Connect I can see the NOTIFY part is working as the value is being updated as the state of the switch changes.

But what I really want to do is use a Raspberry Pi as the central device using Adafruit CircuitPython BLE.

#

Following the examples in this repository, I created a simple program (files attached)

#

The problem I am having is that read_status() will always return whatever the state of the BLE switch is when the program first ran. It doesn't get notified of subsequent states changes of the BLE switch. My thought was that what I am missing is registering with the BLE switch to be notified of changes. I am struggling to find examples or reference to do this.

Thanks.

wooden lagoon
#

When you do self.status = self.switch_characteristic you are reading the value at that point