I’ve looked through the reference documents and haven’t found information specifically for the Photon2. I might have just missed it.
Apparently, the setADCSampleTime() instruction is NOT available for the Photon2 or other Gen3 devices. One location in the reference manual states Gen3 devices have sample times of 10us…however it doesn’t mention the Photon2.
In addition, it is NOT clear whether the Gen3 devices and the Photon2 take multiple samples (5 on previous generations) and average them to obtain a single ADC conversion result.
So just wondering what the execution time of the analogRead() operation on the Photon2 is. Sorry, I haven’t started working with the device yet…still doing some pre-planning.
In other words, 10,000 calls takes 3300 milliseconds, so each call takes 0.33 milliseconds, or 330 µsec. That is much slower than I would have expected, and likely is related to slow digital GPIO.
The ADC can sample much faster in audio mode with DMA (96000 samples/sec) so that might be an option, though I don't have sample code to do it.