I’ve been using Blacklib (http://blacklib.yigityuce.com/index.html) to read 6 of the Analog Inputs of my Beaglebone but I keep get getting this error:
terminate called after throwing an instance of ‘std::ios_base::failure’ what(): basic_filebuf::underflow error reading the file
It doesn’t happen always at the same time, but it will eventually happen at some point. This is my code:
BlackADC * a;
BlackADC * b;
BlackADC * c;
BlackADC * d;
BlackADC * e;
BlackADC * f;
a=new BlackADC(AIN0);
b=new BlackADC(AIN1);
c=new BlackADC(AIN2);
d=new BlackADC(AIN3);
e=new BlackADC(AIN4);
f=new BlackADC(AIN5);
temp_a=a->getConvertedValue(dap2);
while(temp_a==-1.0)
{
temp_a=a->getConvertedValue(dap2);
}
s.a=temp_a;
temp_b=b->getConvertedValue(dap2);
while(temp_b==-1.0)
{
temp_b=b->getConvertedValue(dap2);
}
s.b=temp_b;
temp_c=c->getConvertedValue(dap2);
while(temp_c==-1.0)
{
temp_c=c->getConvertedValue(dap2);
}
s.c=temp_c;
temp_d=d->getConvertedValue(dap2);
while(temp_d==-1.0)
{
temp_d=d->getConvertedValue(dap2);
}
s.d=temp_d;
temp_e=e->getConvertedValue(dap2);
while(temp_e==-1.0)
{
temp_e=e->getConvertedValue(dap2);
}
s.e=temp_e;
temp_f=f->getConvertedValue(dap2);
while(temp_f==-1.0)
{
temp_f=f->getConvertedValue(dap2);
}
s.f=temp_f;
s is a struct that I use to collect all those values together. The read is in a loop that has to run until the user kills it (for periods of about 1 hour) and the values are read as fast as it is possible.
Any suggestions…???