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

Show the "Received Bytes" on nrf52.

Hello everyone! I am working with 2 board nrf52840 with BLE_Blinky_example. When I press button1 on client board, LED1 on sever board is was toggle. I think that : Client board was send one ( or more) byte(s) to server board. And how can I get this bytes on server board. I want to see them in terinal monitor.

Parents
  • Hi,

    Client board was send one ( or more) byte(s) to server board.

    That is correct. The client(central) sets the LED characteristic on the serer(peripheral) to 1 to turn the LED on, and sets the value to 0 to turn the LED off. When this happens, the default-behaviour is that the UART prints the message "Received LED ON" and "Received LED OFF". So if you connect with e.g. termite terminal, you should see this printed on the terminal.

  • For writable characteristics, the stack (SoftDevice) will automatically receive and store any writes to a database(inside the SoftDevice) for you. You will then receive an event that it happened, with a copy of the data. I.e. every time the state changes the led_write_handler() will be called, and you can read LED state from the led_state.

    If you want to have a look at the value at a later point, you can use sd_ble_gatts_value_get() to fetch the current value.

Reply
  • For writable characteristics, the stack (SoftDevice) will automatically receive and store any writes to a database(inside the SoftDevice) for you. You will then receive an event that it happened, with a copy of the data. I.e. every time the state changes the led_write_handler() will be called, and you can read LED state from the led_state.

    If you want to have a look at the value at a later point, you can use sd_ble_gatts_value_get() to fetch the current value.

Children
No Data
Related