Sampler on Imp004m?

I recently bought the new imp004 breakout to move from imp002 to imp004.
When I changed the code to adapt it to this new device an error with the sampler occurred

the index ‘sampler’ does not exist

I firstly thought it would be something in my code, but the error keeps occurring even wih the example code from the API !

Is there any difference with sampler for imp004?

I’m afraid the imp004 doesn’t include a sampler. See

Then, Can I replace the class with a function that takes samples periodically or it is not able to make a lot of samples per second?

Could I use an external ADC to sample the signal? How could I create interrupts to read from the I2c ADC?

A Squirrel-based sampler is unlikely to be fast enough for (say) audio; however, you could use an external ADC as you suggest.

If the ADC provides a signal indicating a full buffer, you can connect this to a GPIO pin on the imp configured as a digital-in, to trigger a callback function to read and process the data.

The real question is what are you trying to sample? At low frequencies then yes an imp.wakeup that reads the pin can work, but I’d say above 10Hz that’s going to be problematic and also you’ll get jitter on sampling times which may also be a problem.

We are adding support for DFSDM microphones on 004m for audio input, for example (and PWM-driven audio output too). These should both be in release 38.

ImpOS 38 is now available for beta, including DFSDM audio input and PWM-based output. If you’d like to have any imp004s updated to try these out, please send a direct message with their IDs or MAC addresses.