Random delay before advertising

Hello Everyone,

I would like to implement a random delay of 10 to 3000ms before my development kit start advertising itself.

I'm using nRF5dk v17.1.0. 

How do i go about this?


Regards,

Zachary

Parents Reply Children
  • Hello Zachary,

    You need to set how long the app_timer instance should be delayed until it executes. So a while loop like this will be there- 

    while(wait_for_this_variable)

    the formula of delayed app inside the nrf_delay_ms () function cna be implemented like this: 

    nrf_delay_ms((random_16_bit_number + 10) % 3000)

    Try to implement this in your code.

    Best Regards,

    Kazi Afroza Sultana

Related