3 years, 3 months ago.


How I change the brightness of a LED with pwm using BLE and a custom GATT service? Can I only write data from my phone(master) and don't use de read mode on the device? Thanks you for share a short code to explain your argument! Charles B.

Comment on this question

1 Answer

3 years, 3 months ago.

So you'd want a characteristic that is a `uint8_t` or a `uint16_t`. Then whenever a write happens to this characteristic (from a phone) you can catch that write through the onDataWrittenCallback function. In here you parse the new value, transform it into a `float` and write it back over PWM to the LED.

I did this in here.

Or maybe look at SimpleBLE, it makes cases like this very easy.