[Solved]Write from Central to Peripheral


#1

Hello there,

I would like to write value from a Central device to a Peripheral (the two boards are Nano v2). All the example found and provided are doing the reverse. I’m still looking for the right way to do it after many unsuccessful attempts.
Any help is welcome!

Thanks in advance.
Christophe


How can send an String data each 2 module Nrf51822
#2

Hi xtof,
You can refer to this ticket which shows how to communicate between a central device and a peripheral. Or you can refer to simpleChat


#3

Hi,

Thanks Lucian for the leads. But, even exploring different ways to write from central to peripheral from the post you gave I haven’t succeed to write on the peripheral. The peripheral does not react to the writings even though the write seems working well (the serial print on terminal call all the callback as they should).

I understood that there is to way to do (notifying the peripheral which subscribe to change on central, or direct write from central to peripheral). But in both attempts, I failed to make it works.

Would that be possible to someone to post a small but complete example of central to peripheral writing?

Thanks in advance for the help!


#4

I use Redbear DUO with SimpleBLECentral as central to write data to Nano2 as peripheral with SimpleChat example. It succeeds in transfer.

    uint8_t temp[] = "abcde";
    if(device.connected_handle != NULL)
    {
      delay(2000);
      ble.writeValue(device.connected_handle, device.service.chars[0].chars.value_handle, 5, temp);
    }

#5

Thanks Lucian,

In the meantime I found a nice article on how to write from Central to Peripheral and since then I got my hardware perfectly running.

Here the link for whom are interested on how to write from central to peripheral.
BLE Central Role to Peripheral with YN360 example