I am a python beginner, I read a lot of related questions, but they all ask us to look heart_rate_collector.py , but heart_rate_collector.py did't not have any example, i really don't understand how to used it.
I am a python beginner, I read a lot of related questions, but they all ask us to look heart_rate_collector.py , but heart_rate_collector.py did't not have any example, i really don't understand how to used it.
Have you enabled notifications with enable_notification()? If not, you will not get any notifications, and on_notification() will never be called
I want to record the notify in 0XFFF6 like image below
but now I have enable notification(),still can't received the data.
I see from the log that you find that characteristic during service discovery. Then the next is to enable notifications using enable_notification with that UUID.
def connect_and_discover(self): scan_duration = 5 params = BLEGapScanParams(interval_ms=200, window_ms=150, timeout_s=scan_duration) message = "We are connected!\r\n" self.adapter.driver.ble_gap_scan_start(scan_params=params) try: new_conn = self.conn_q.get(timeout=scan_duration) self.adapter.service_discovery(new_conn) self.adapter.enable_notification(new_conn, self.nus_tx) return new_conn except Empty: print("No device advertising with name {TARGET_DEV_NAME} found.") return None
Yes ,I have enable notifications using enable_notification in the "def connect_and_discover(self):"
Is enable_notification() return anything? or how do I know this function is working?
Yes, it does return a status. You can see that from looking at the implementation. What is self.nus_tx? Is it the right UUID?