Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years, 6 months ago.
BLE LED CHANGE BRIGHTNESS
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.
1 Answer
8 years, 6 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.