This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

n-AN36 change the Button to PWM

I would like to modificate the LED Button application example. The LED characteristic should stay as it is, only the Button characteristic should be changed. I want to use the button characteristic to send the value of a pwm signal. When the device is in connection, it should always send the value of the pwm signal.

Goal of the changes :

1.)

The button_state value should be send all the time and not only when the button is pressed. I`m not sure, but I think that the button will be detected in the button_event_handler. If my presumption is true, how can I change that the value of the button_state will always be send?

2.)

The value of the button_state should have a range from 0-100 and not only 1 or 0. Where in the code the value of the button_state will be set ?

And do I have to change configuration of the value?

EDIT

main.c

Related