Hi all,
I've rewritten pyusbdux now with callbacks. So instead of doing polling
in python in a loop the python program registers a callback and then
receives the samples at the requested sampling rate:
#!/usr/bin/python3
import pyusbdux as dux
class DataCallback(dux.Callback):
def hasSample(self,s): # <-- sample arrives here
print("s:",s)
cb = DataCallback()
# open default USBDUX
dux.open()
# sampling from 8 channels
# at a sampling rate of 250Hz.
dux.start(cb,8,250)
# Just idles till the user presses return.
input()
# Stops the data acquisition.
dux.stop()
https://github.com/berndporr/pyusbdux
https://pypi.org/project/pyusbdux/
Coding-wise it's an interesting twist with an interface between two
languages and swig is managing that. I'm using std::array which is now
fully supported so that the number of elements in an array are no longer
a problem.
Best,
/Bernd
--
www:
http://www.berndporr.me.uk
http://www.tinnitustailor.tech
http://www.attys.tech
Mobile:
+44 (0)7840 340069
Work:
+44 (0)141 330 5237
University of Glasgow
School of Engineering
Rankine Building, Oakfield Avenue,
Glasgow, G12 8LT