nRF51822 turn on- turn off led uart i code not work

Deat all,

nRF5_SDK_12.3.0_d7731ad\examples\ble_peripheral\experimental_ble_app_blinky\pca10028\s130\arm5_no_packs

I use app "nRF connect for mobile" : I send CM : turn on led 24  -> Led 24 on , Turn off led led 24  -> led 24 off.

achievement : i get the result on the uart  screen  "turn on led 24" and "Turn off led led 24" but LED 24 not work. please help me to solve the problem

#define LEDBUTTON_LED1 24

at uart_event_handle : i code

if (index >= 14 && strncmp((const char*)&data_array[index - 8], "turn on led 24 ", 14) == 0)

{  

 nrf_gpio_pin_set(LEDBUTTON_LED1);

}

if (index >= 14 && strncmp((const char*)&data_array[index - 8], "turn on led 24 "14) == 0)

 

 nrf_gpio_pin_clear(LEDBUTTON_LED1);

}

thank you,

Im sorry my english not ok.

Parents Reply
  • i put it in the wrong place, i put the code in this function and it worked : nus_data_handler. it work ok

    and i have more questions.

    I have 2 nRF51822 where 1st nRF51822 acts as BLE Central and 2nd nRF acts as ble_Peripheral. Both devices connect to each other. now 2nd device ble_Peripheral i want to remove connection with 1st device and connect to 3rd device(acting as BLE Central) th device just press button and scan 3rd device and connect , and save the connection to the 3rd device.
    Please help me solution or reference.

    Best regards

Children
Related