random delay

I want to add a random delay in range 2000 to 3000 ms before my device perfrom any activity.

pls tell how can do this at earliest

usins some  timer or something else

Parents Reply
  • The warning you're seeing is due to the types not matching.

    You can either cast the input, like so:

            err_code = sd_rand_application_vector_get((uint8_t *)&rand_value, sizeof(rand_value));
    

    or declare rand_value as a uint8_t array: uint8_t rand_value[2];

    For the sd_rand_* API to provide you with random bytes, you need to call this after the softdevice has been initialized (ie. after ble_stack_init()).

     

    Kind regards,

    Håkon

Children
Related