BLE.gattc_write how to write data

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
Tinus
Posts: 40
Joined: Sun Feb 14, 2021 4:53 pm

BLE.gattc_write how to write data

Post by Tinus » Sun Mar 14, 2021 8:03 pm

I am trying to read from my Polar H10 heartrate sensor.

I managed to use BLE to find the address and connect to it.
Now apparently I have to write to characteristic 0x0012 as in the gatttool example:

Code: Select all

[CON][00:22:D0:33:1E:0F][LE]> char-write-req 0x0012 0100
[CON][00:22:D0:33:1E:0F][LE]> Characteristic value was written successfully
And I have tried every which way to use gattc_write to write things and many times I get a _IRQ_GATTC_WRITE_DONE
but I never get anything after that.

at the moment I try this:

Code: Select all

self.p.gattc_write(self.conn_handle, 0x0012, bytearray([0x01, 0x00]), True)
I honestly don't know why but there you have it.

How do I send 0100 to 0x0012 ?

I hope to oneday receive notifications from 0x0011

Tinus
Posts: 40
Joined: Sun Feb 14, 2021 4:53 pm

Re: BLE.gattc_write how to write data

Post by Tinus » Fri Mar 26, 2021 3:44 pm

I got it to work.

I was writing to the wrong characteristic. :?

the correct characteristic for the polar H10 is 0x0011

Post Reply