I have done the ble_app_blinky example, for both central and peripheral. I press button at central and LED glow at peripheral and vice-versa.
I am struggling in using the code for multiple buttons and multiple LED's. Like Button1, button2, button3 at central to control LED1,LED2,LED3 of peripheral respectively and vice-versa.
//------------------------
static void buttons_init(void)
{
uint32_t err_code;
//The array must be static because a pointer to it will be saved in the button handler module.
static app_button_cfg_t buttons[3] =
{
{LEDBUTTON_BUTTON_PIN_1, false, BUTTON_PULL, button_event_handler},
{LEDBUTTON_BUTTON_PIN_2, false, BUTTON_PULL, button_event_handler},
{LEDBUTTON_BUTTON_PIN_3, false, BUTTON_PULL, button_event_handler}
};
err_code = app_button_init(buttons, sizeof(buttons) / sizeof(buttons[0]),
BUTTON_DETECTION_DELAY);
APP_ERROR_CHECK(err_code);
}
If I do this for 3 buttons to transmit status, I think it will transmit the status of three buttons one by one. But then how am I going to differentiate at the receiver end which data for which LED. Also, do I need to make changes in the LED and Button services.
Following that code I go down the rabbit hole to board.c, bsp.c, pca10040.h, ble_lbs.c, ble_lbs.h etc. but didn't understood what changes to do.
What I actually want is a BCD counter, if I press a button at tx, corresponding led should glow at rx,