A header-only C++ library which provides a C++ callback interface for the async analogue data acquisition of the USB-DUX sigma.
- Define a callback which is called at the samplingrate
struct DUXCallback : CppUSBDUX::Callback {
virtual void hasSample(const std::vector<float> &data) {
/// Do something with "data" here!
}
};
DUXCallback cb;
- Create an instance of
CppUSBDUX
for example as an instance varibale in your application class.
CppUSBDUX usbdux;
- Open the USB-DUX device
usbdux.open();
- Start the data-acquistion
usbdux.start(&cb,8,250);
where the callback cb
is called at a rate of 250Hz and it delivers
8 channels.
- Stop the data-acquisition
usbdux.stop();
To run the demo just type
cmake .
make
and then run
./print2screen_demo
which prints the values of the 1st 8 channels in Volt on the screen. You can pipe them into a text-file and plot them:
./print2screen_demo > /tmp/data.txt
gnuplot> plot "/tmp/data.txt" using 1 w l