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

How to change from BLE central to peripheral mode by buttons

Hi, I was wondering how to change from central mode of the NRF52 board to peripheral mode and from peripheral mode to central mode by pressing the input buttons on the board. For example, button 1 would enable the central mode which is when the NRF52 board is acting as the client and wants to send data and then button 2 would enable the peripheral mode when the NRF52 board is advertising to be connected to another BLE device, but then disable the central mode which is button 1.

Are there any examples related to this? Any help would be appreciated.

Parents Reply
  • Thank you that is what I have done. However, when I flashed the code in the NRF52 board and checked in the UART terminal, it would give me a APP_ERROR:ERROR:Fatal when attempting to have a UART service as we discussed before. I was not sure why though.

    Should I keep the m_ble_nus_c and the m_ble_hrs_c variables because I am trying to implement the m_ble_nus_c similar to the UART example that you have provided, but still implement it within the heart rate example?

    UPDATE: The line number for the error code is 0x6508, the p_file_name is 0x000281D5, and the error code is 0x00000106.

    Here is what I have so far if you wanted to take a look at it. gist.github.com/.../26f0a96596d019c414d641fe2c5a157f

Children
No Data
Related