now i use nRF52832 and my using paccage is SDK14.0.0 i could send data from phone to nRF52832. next i wanna send data from nRF52832 to phone. but i don't know where to change in the source code. What should i do?
thank you in advanced
now i use nRF52832 and my using paccage is SDK14.0.0 i could send data from phone to nRF52832. next i wanna send data from nRF52832 to phone. but i don't know where to change in the source code. What should i do?
thank you in advanced
Hi Kaito!
There is several ways to do this. You can send some data to your phone after a keypress, at a certain event or set up a timer and send data at a fixed interval etc. I also don't know what type of data you want to send.
There are several examples in the SDK that can send data to your phone. But you can take a look at the ble_app_uart example, and the way it is done there.
Just as a simple example, you can add this to the bsp_event_handler
in the ble_app_uart example:
case BSP_EVENT_KEY_1:
{
uint8_t data[6] = "Hello!";
uint16_t length = 6;
ble_nus_string_send(&m_nus, data, &length);
}
This will make your application send the string "Hello!" each time you press button 2, if you connect your phone via UART in the nRF Toolbox app.
Best regards,
Joakim.
Hello,
you can just use the UART example in your SDK. via the service nus, you will be able to send what you want from and to your nRF52 through a terminal.
please check this link.
regards.
thank you for your reply. i could send the data to iphone!!
I really appreciate your advice!!!
Hi. I'm sorry, this is all my mistake. The code snippet in my answer should be in the bsp_event_handler
NOT the ble_event_handler
. I will edit my answer.
@Joakim - I keep getting an error NRF_ERROR_INVALID_STATE when I do this. Any ideas? Thank you!