I want to read this characteristic value in C program. Can anyone please provide me the code snippet for the same?

Hi, in the below file (gattprofile.h) we have a characteristic SIMPLEPROFILE_CHAR1, I want to get it's value, can anyone please provide code snippet how to do that.

image.png

you are which county people?


from India


You can directly modify the peripheral.c code. This is roughly the eigenvalue that you want to get。

emobile_2022-12-12_10-22-40.png


Actually I want to modify the pin value of the board like this GPIOA_ModeCfg(GPIO_Pin_12, GPIO_ModeOut_PP_5mA) to light the led, which is the value I will be sending from external source (app), I am doing this process with changing the characteristic values, because that is the only value we can read write from the app.


Also you mention the eigen value, let's say if the string message that I set in this attribute is 'h'. How should I check this value in peripheral.c code? Like below ?


(SIMPLEPROFILE_CHAR1 == eigenValue('h'))




Do you want to send a value through an external APP to light up the LED? You can be direct about your problems and needs. It's better to know what you need, and I sent you a modified program earlier so you can see the values that you've written through the app. There is no need to modify the eigenvalues. You might want to comb through the code logic.


Yes, I want to send a value externally to light an LED, as below:


GPIOA_ModeCfg(GPIO_Pin_12, GPIO_ModeOut_PP_5mA); // PA12 - PWM4

GPIOA_ModeCfg(GPIO_Pin_13, GPIO_ModeOut_PP_5mA); // PA13 - PWM5

GPIOB_ModeCfg(GPIO_Pin_0, GPIO_ModeOut_PP_5mA);  // PB0 - PWM6

GPIOB_ModeCfg(GPIO_Pin_4, GPIO_ModeOut_PP_5mA);  // PB4 - PWM7

GPIOB_ModeCfg(GPIO_Pin_6, GPIO_ModeOut_PP_5mA);  // PB6 - PWM8

GPIOB_ModeCfg(GPIO_Pin_7, GPIO_ModeOut_PP_5mA);  // PB7 - PWM9

GPIOB_ModeCfg(GPIO_Pin_14, GPIO_ModeOut_PP_5mA); // PB14 - PWM10

//  GPIOB_ModeCfg(GPIO_Pin_23, GPIO_ModeOut_PP_5mA); // PB23 - PWM11 此脚复用为外部复位脚,需要关闭此功能才能开启PWM功能


PWMX_CLKCfg(4);                                   // cycle = 4/Fsys

PWMX_CycleCfg(PWMX_Cycle_64);                     // 周期 = 64*cycle

PWMX_ACTOUT(CH_PWM4, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM5, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM6, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM7, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM8, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM9, 64 / 4, Low_Level, ENABLE);  // 25% 占空比

PWMX_ACTOUT(CH_PWM10, 64 / 4, Low_Level, ENABLE); // 25% 占空比


Can I send these values directly from my app?



You can turn on the LED by writing a value through the wirte channel. The specific operations need to be done through your code. The key here is the code that you're lighting up or you're doing something else and the key here is what your code is doing. Refer to the routines we provide for the types of values written accordingly.


只有登录才能回复,可以选择微信账号登录