giuliomoro Just a short postscript: I tested the solution (using the "hidden", original PocketBeagle analog inputs within Pure Data) and it works great - everything's ok and the readings are stable, the only thing that is less than satisfactory (altohough exactly just like you've described it) is the frequency of the readings - between 19 and 20 per second). I was just wondering if there is a possibility of a simple tradeoff - i.e. if I would only like to read 3 out of 8 inputs, would the readings be faster? Or it doesn't matter and it would be still the same frequency?
Lots of inputs...what are my options ?
The reading loop in the code is:
while(!Bela_stopRequested())
{
for(size_t n = 0; n < gLowResAnalogIn.size(); ++n)
{
path[x] = '0' + n; // int to char
std::string ret = IoUtils::readTextFile(path);
gLowResAnalogIn[n] = std::atoi(ret.c_str()) / 4096.f;
}
usleep(kLowResAnalogInSleepUs);
}
and the kLowResAnalogInSleepUs
constant is defined as:
static constexpr size_t kLowResAnalogInSleepUs = 50000;
which is what's driving your sampling period. Change it to, e.g.: 10000µs to get about 100Hz.
giuliomoro <3 I'll give it a try, thank you!