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

How do I "capture" 100 values of a terminal, make the average , and store that in a variable?

I have variable values coming out of a terminal at all the time. I using this command:

void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action) {

if(pin  == PIN_IN_2)
{
    NRF_LOG_INFO("Timer value: %d",nrf_drv_timer_capture_get(&m_timer, NRF_TIMER_CC_CHANNEL0)); 
    nrf_drv_timer_clear(&m_timer);
}

}

My question is how do I "capture" for example 100 values, make the average , and store that in a variable?

Related