This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How to set timer delay for each of data for sending from nrf52840 to android apps ?

I have followed this tutorial from this link but cannot get it work.

I have 3 loop. For the first loop of sending data it will have a delay about 1s and until 2 finish. But there is no delay and it does not work.

Parents
  • Hello,

    The timer setup you use is something you haven't found in your link, right?

    I don't know what you expect, but I suspect that you expect the app_timer_create() and app_timer_start() to delay your application for 1 sec. Unfortunately it does not. Besides, you should check the return values from the functions that return values, such as app_timer_create() and app_timer_start. You will see that these will probably not return NRF_SUCCESS, at least not the second time.

    If you want to send a notification every 1000ms, you can trigger this from the interrupt handler in the timer, which looks like the uart_event_handle. You should create a separate event handler, not share it with the uart_event_handle. 

    The point of the APP_TIMER_MODE_REPEATED is that it will reset once you get the timeout event, so you should only start it once.

    Look at how the app_timer is used in the ble_app_hrs example. It uses this timer to send a new battery status notification on every timeout.

    1. Thanks bro for helping. Yes I cannot find the timer in the link. I will try to use the example.
Reply Children
No Data