⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
6 posts / 0 new
Last post
MADHUSF
Offline
Last seen:1 month 1 week ago
Joined:2018-01-15 09:22
PWM timer0

Hi,

The information provided is useful.

But i want to change the brightness of LED through PWM_HIGH and PWM_LOW.

Can you please explain the significance of that definitions and is it possible to control brightness of the led through custom characterstics in BLE.if possible explain the procedure please

Device:
PM_Dialog
Offline
Last seen:58 min 2 sec ago
Staff
Joined:2018-02-08 11:03
Hi MADHUSF

Hi MADHUSF

If I am able to understand correctly from what you mentioned is to produce a PWM when a characteristic is written from a peer device? So, that you would like to accomplish is to change the brightness of the LED according to the value the you write to the characteristic Is that correct? If yes, you should implement a writable characteristic and you can have a look at the ble_app_sleep_mode example of the SDK. After that, you should make the PWM_HIGH and PWM_LOW in the PWM example of the SDK undefine and define the 2 variables where the value of the characteristic will be stored. I mean that both PWM_HIGH and PWM_LOW in the PWM example are astatic, so you will have to make them dynamically checked according the to value of the characteristic.

Thanks, PM_Dialog

MADHUSF
Offline
Last seen:1 month 1 week ago
Joined:2018-01-15 09:22
Hi,

Hi,

I have Checked your answer.but i m unable to get what is important of sleepmode,can you explain.

and

1.one thing is as said"define the 2 variables where the value of the characteristic will be stored." i want to know where the value is stored by default??

2.I want to control the led brightness with help of PWM_HIGH and PWM_LOW,is it possible to control the voltage output of Ports??

PM_Dialog
Offline
Last seen:58 min 2 sec ago
Staff
Joined:2018-02-08 11:03
Hi MADHUSF,

Hi MADHUSF,

Apologies for the confusion, I meant the ble_app_peripheral example of the SDK which is located under 5.0.4\projects\target_apps\ble_examples SDK folder path. Please check how the “Control Point” characteristic has been implemented, which is a writable characteristic. Once you write a value to the characteristic from a peer BLE device (for example a generic BLE mobile application), you get a CUSTS1_VAL_WRITE_IND command, which is handled by the user_catch_rest_hndl() function. Except from this command which will inform the application that a characteristic has been written, you also get a CUST1_IDX_CONTROL_POINT_VAL, which indicates that the “Control Point” characteristic has been written, so the user_custs1_ctrl_wr_ind_handler() will be triggered. You can easily test it by adding a break point there. If you check the implementation of this function you will see that the value which has been written is saved (memcpy()) to the val. That you will need to do is to implement 2 writable characteristics, one for PWM_HIGH and one PWM_LOW, and then pass the value to the PWM.

Thanks, PM_Dialog

MADHUSF
Offline
Last seen:1 month 1 week ago
Joined:2018-01-15 09:22
Hi,

Hi,

I checked your answer but can you explain neat step by step or flow to to implement PWM using our SDK kit,like we have tutorial for custom characterstics tutorial.or else help with neat steps

1.我想控制亮度LED (PWM)(续rolling the Output voltage at ports) through the writable charcteristics.

fro example if i write 1-10 based on scale the brightness should change like that code i have to implement through BLE.can you please explain the step by step or flow to do that?

PM_Dialog
Offline
Last seen:58 min 2 sec ago
Staff
Joined:2018-02-08 11:03
Hi MADHUSF,

Hi MADHUSF,

Since you created two writable characteristics, one for the PWM_HIGH and one for PWM_LOW, you should save both values into two global variables. After that, you should pass these values into the timer0_set() arguments.

Thanks, PM_Dialog