Hi All,
How I can implement period advertising? For example, start advertising, stop after 10 sec and restart it after 10 sec?
Thanks!
Hi All,
How I can implement period advertising? For example, start advertising, stop after 10 sec and restart it after 10 sec?
Thanks!
Hello,
There are a couple of ways you could go about doing this. The easiest is probably to set up a timer, and have the device start and stop based on the events generated by the timer.
I recommend familiarizing yourself with the APP_TIMER library and its usage by reading this infocenter page. If you have previous experience working with embedded timers, you could also see TIMER peripheral driver directly.
If you would like to see this usage demonstrated, you could take a look at the Heart Rate example.
In this example, multiple timers are set up to trigger tasks at different intervals. For example, the BATTERY_LEVEL_MEAS_INTERVAL is set to 2000 ms, and in timer_init() the timer is initialized and connected to the battery_level_meas_timeout_handler() which then is called every 2. seconds.
For example, start advertising, stop after 10 sec and restart it after 10 sec?
You could for example set up a timer to trigger every 20th second - starting advertising - and then you could have the advertising time out after 10 seconds.
Is this what you were looking for?
Please let me know if something is still unclear, or if you have some more questions.
Best regards,
Karl