ul-gh / PiPyADC

Python classes for interfacing Texas Instruments analog-to-digital converters with the Raspberry Pi
GNU Lesser General Public License v2.1
69 stars 27 forks source link

question: is it possible to get many samples at once ? #15

Closed asafosci closed 5 years ago

asafosci commented 5 years ago

I'm sampling at around 50 Hz. the library works extremely well. Currently i use a while loop and call ads.read_continue() inside. is it possible to forego the loop and somehow let the ads call back instead when it has 50 samples ready and maybe even place them to memory to be collected ?

ul-gh commented 5 years ago

Hi,

sorry for the late answer. In case this still helps, you can very easily implement or add a callback function from your main program to a measurement loop inside a measurement function.

Example see: https://stackoverflow.com/a/40843238

Also, you might want to have a look at the threading module: https://docs.python.org/3/library/threading.html

Regards, Ulrich