Hi,
I have 4 sensors on my custom board and I'm planning to use BLE. I want to read data from all 4 sensors every 200ms. I'm planning to use app_timer for that and read the data in a callback function or something like that. Is this the way to go?
Also, some of my sensors require a delay for analog to digital conversion and things like that. Those delays are in terms of miliseconds. Do I use nrf_delay_ms() for that or do I use something else? I remember reading somewhere that that kind of delay can mess up softdevice functionality and that it should be used for testing only. Additionally, I'm using retargetted printf for simple UART communication and that seems to mess up the nrf_delay_ms somehow. For example this code does not invert the leds:
bsp_board_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS);
if ((err = uart_init()) != NRF_SUCCESS)
bsp_board_leds_on();
printf("### Application started ###\r\n");
if ((err = twi_init()) != NRF_SUCCESS)
bsp_board_leds_on();
//printf("TWI Initialized\r\n");
while(1)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
bsp_board_led_invert(i);
nrf_delay_ms(500);
}
}
but this code does invert the leds (notice that first printf is commented)
bsp_board_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS);
if ((err = uart_init()) != NRF_SUCCESS)
bsp_board_leds_on();
//printf("### Application started ###\r\n");
if ((err = twi_init()) != NRF_SUCCESS)
bsp_board_leds_on();
//printf("TWI Initialized\r\n");
while(1)
{
for (int i = 0; i < LEDS_NUMBER; i++)
{
bsp_board_led_invert(i);
nrf_delay_ms(500);
}
}
and that's really strange to me. Anyone has any idea why that is?
Thank you for your time,
squeeky