How to scan multiple peripheral devices and get connected to one.

Hi,

I'm using nRF5340 DK, one board is programmed as central and 2 boards are programmed as peripherals. When I flash the central program it is selecting a random board and getting connected to it. All I wanted to do is after scanning the central should display all the peripherals it has scanned, later it should ask the user to input the peripheral address of choice and once user inputs the data, needs to get connected to that particular board. I'm stuck with this. Can you please help me?

Regards

Karthik Kumar

Parents
  • Hi Edvin,

    How do you want to pass on the address?

    I want to pass it via the terminal window, PuTTy. Manually enter the data.

    I understand what you want to do, but there are a million different ways to acheive this. Do you want your device to have it's own keyboard, do you intend to receive the data over UART? Do you want to control it via buttons? Whatever solution you go with, it requires some work for your application to do what you want it to. This is why I ask the questions above.

    Wanted to control it via keyboard.

  • Ok, in that case, you have to disable the UART logging (you can change it to RTT logging) so that you free up the UART. Then you need to print the scanned adresses over UART when you scan them, and then you need to interpret the incoming UART data. You can look at the NCS\nrf\samples\bluetooth\peripheral_uart sample to see how to send and receive data through the UART.

    Best regards,

    Edvin

Reply
  • Ok, in that case, you have to disable the UART logging (you can change it to RTT logging) so that you free up the UART. Then you need to print the scanned adresses over UART when you scan them, and then you need to interpret the incoming UART data. You can look at the NCS\nrf\samples\bluetooth\peripheral_uart sample to see how to send and receive data through the UART.

    Best regards,

    Edvin

Children
No Data
Related