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

Adding Blinky features in my Example

Hi,

I am working on a project where I am sending and receiving Encrypted string data from my phone with nRF Toolbox to the nRF52840 DK. The basic paring is established along with bonding.

I am able to send and receive strings from both the sides too. Now I added a button to the nRF Toolbox UART feature.

Now when I press the button an led on the nRF52840 DK should glow. I am done with the app side but I wanted to add the blinky features to the nRF52840. But I am getting a FATAL ERROR.

I didn't do many changes in my code. I just added the below functions to my code can you please tell me the error.

static void led_write_handler(uint16_t conn_handle, ble_lbs_t * p_lbs, uint8_t led_state)
{
    if (led_state)
    {
        bsp_board_led_on(LEDBUTTON_LED);
        NRF_LOG_INFO("Received LED ON!");
    }
    else
    {
        bsp_board_led_off(LEDBUTTON_LED);
        NRF_LOG_INFO("Received LED OFF!");
    }
}

static void services_init(void)
{
    uint32_t err_code;
    ble_nus_init_t     nus_init;
    ble_lbs_init_t     init     = {0};
    
    // Initialize NUS.
    memset(&nus_init, 0, sizeof(nus_init));

    nus_init.data_handler = nus_data_handler;

    err_code = ble_nus_init(&m_nus, &nus_init);
    APP_ERROR_CHECK(err_code);

    //Initialize LBS.
    init.led_write_handler = led_write_handler;

    err_code = ble_lbs_init(&m_lbs, &init);
    APP_ERROR_CHECK(err_code);
}
 

Parents Reply Children
No Data
Related