11 years, 1 month ago.

Can a ticker call a function at a constantly varying time?

Hi

You probably need to detach the ticker before selecting a new sample rate:

void sample_rate(){
    ADC_sampling_rate=((float)t_period/1000000)/32;   //divides period by 32 to calculate sampling rate (in sec) for 32 samples per period
    ADC_set.detach();
    ADC_set.attach(&ADC,ADC_sampling_rate);
}

Are you sure that the 128 samples have not yet been collected before you attempt to select a new rate. In that case it would never get selected because the while loop has finished.

posted by Wim Huiskamp 15 Nov 2013

Hi Wim

I have tried changing the size of the array and the length of time the sample function is being called which updates my ticker with a new time value but I cant seem to figure it out, have you any ideas as to why this is not working??

Thanks

posted by Alan Carson 18 Nov 2013

I have used a ticker with a varying time with no problems, what you may need to look at is the rate value, to be sure it can be achieved.

posted by David Fletcher 09 Feb 2014
Be the first to answer this question.