Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How send simple string message ble_peripheral to central multilink example.

Hi,

I am using nRF52832 DK and other same custom board, sdk v15.0 with SES IDE. My application like this:

For ble peripheral used example ble_app_uart and for central used multilink example.

I want to send sensor data using ble_app_uart to central multi-link after completed sending sensor device will go to sleep and it will again wake-up after 1Hr and automatically connect to central and send sensor value to connected central. This will continuous monitoring process and my sensor device is battery operate supply.

Now, i am facing following issues:

  1. How i can send simple string message to connected central, which function and how i can use in my peripheral side.
  2. I was refer this link and also changes done replace ble_lbs_c  by ble_nus_c  but not receiving and also not able to show incoming message on console at central side.
  3. My peripheral device is connected to central and in peripheral i written simple code for sending message:

void send_to_central()
{
    uint32_t err_code;
     uint16_t length = (uint16_t)5;
    char string[5] = "Hello";
    err_code = ble_nus_data_send(&m_nus, string, &length, m_conn_handle);
    APP_ERROR_CHECK(err_code);
    if ( (err_code != NRF_ERROR_INVALID_STATE) && (err_code != NRF_ERROR_BUSY) &&
         (err_code != NRF_ERROR_NOT_FOUND) )
          {
              APP_ERROR_CHECK(err_code);
          }
  NRF_LOG_INFO("Send to central\r\n");
}

But Not receiving at central side. Please help me where i am wrong.

Please provide me example code for sending and receiving string message over peripheral to central.

 Thanks in advanced.

Parents Reply Children
No Data
Related