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
  • Hi, thanks for your response. Do you know if there is a way that I can run an example code for each button that I press. For example, for button 1, is there a way to run the Central mode connection example that you provided and for button 2 have a peripheral mode example code run. I wasn't sure how to do that in the BLE Relay example. I know that I have to call the button_handler method, but I was not sure how to move forward from that. Please let me know if you have any questions.

Children
No Data
Related