10 years, 6 months ago.

is it possible to vary the rate at which a Ticker calls a function continuously?

Hi

I have a program which measures an input sinusoidal waveform and calculates the period of the input waveform. I want to measure each period of my waveform exactly 32 times to get an accurate reading of the input waveform so I was taking my value of period and dividing it by 32 to get the rate at which I want to call my sampling function. In this program the period will vary and therefore I was wanting to know is it possible to attach a ticker to call my sampling function at a constantly changing time? I have tried to get this working without any success.

For example will this work:

ADC_set.attach(&ADC,ADC_sampling_rate); attach a ticker ADC-set to call ADC function at the sampling rate calculated (ADC_sampling_rate) to allow 32 samples per period

Thanks

1 Answer

10 years, 6 months ago.

Just recall attach every time you got a new sampling rate.

Thanks Erik

posted by Alan Carson 03 Nov 2013