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.

  do
                    {
                       
                         int i;
                     
                       char buf[42];
                        for (i = 0; i < 3; i++) {
                      snprintf(buf,42, "A%dBBCCDDEEAABBCCDDEEAABBCCDDEEAABBCCDDXX", i);         
                      // puts string into buffer
                       printf("%s\n", buf); // outputs so you can see it

                       APP_TIMER_DEF(buf);
                          
   app_timer_create(&buf,APP_TIMER_MODE_REPEATED, uart_event_handle);
    app_timer_start(buf, APP_TIMER_TICKS(1000), NULL);

                         
                           uint16_t length2 = sizeof(buf);
      
                           err_code = ble_nus_data_send(&m_nus,buf, &length2, m_conn_handle);
                          


                       }
                      
                        if ((err_code != NRF_ERROR_INVALID_STATE) &&
                            (err_code != NRF_ERROR_RESOURCES) &&
                            (err_code != NRF_ERROR_NOT_FOUND))
                        {
                            APP_ERROR_CHECK(err_code);
                        }
                    } while (err_code == NRF_ERROR_RESOURCES);

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 Reply Children
No Data
Related