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

How to disconnect nRF8001 from a nRF52 board?

I am working on a project involving BLE communication, but I am quite new to BLE, so please be patient.

The project scenario is the following: I have a nRF52 feather board (from Adafruit: learn.adafruit.com/.../bluefruit-nrf52-api) working as the central and two nRF8001 modules (from Adafruit, too: learn.adafruit.com/.../introduction) working as peripherals. One peripheral is wired up with a Flora board and a UV sensor, the other one instead is wired up with a Lilypad board and a temperature sensor. See the following picture depicting the communication scenario just described. image description

I have to retrieve both sensors values and send them to the nRF52 board through the nRF8001s. Since only one connection at a time should be active, I need to connect the nRF52 to BLE peripheral #1, sense the sensor value and send it back to the nRF52. Then drop this connection and establish a new one with the BLE peripheral #2, sense the sensor value and send it back to the central. And repeat this routine iteratively.

My question is: how do I have to do (in terms of code) to disconnect the central from peripheral #1 and establish the connection between central and peripheral #2?

Moreover, I would be able to exploit the nRF8001's RDY pin in order to perform a certain task only if there is incoming data fromthe BLE connection. How do I check (in terms of code) this stuff?

Hope to be as much clear as possible, if not, pleas let me know and I will try to explain me better. Thanks in advance, Filippo

Related