Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

Can't proproly recive commands form mobil

I'm just trying to make a simple communicatión between my nrf52 dk and my mobil using Serial Bluetooth Terminal app. I took the ble_app_uart example and I added a function that turn on or off the Led 2 if the DK recives a 'a' or a 's', but I don't know why it didn't work, and I can't find out where is the error.

The only thing I changed is the for loop for a while loop, where I added the idle_state_handle function and the function I developed  

static void communication(void)
{
	uint8_t command;
	
	while(app_uart_get(&command) != NRF_SUCCESS);
	
	if(command == 'a')
	{
		bsp_board_led_on(1);
		printf("Leds turned on!!\r\n");
	}
	else if(command == 's')
	{
		bsp_board_led_off(1);
		printf("Leds turned off!!\r\n");
	}
	else
	{
		printf("Invalid command!!\r\n");
	}
	
}

Parents Reply Children
No Data
Related