I keep getting this errors
terminate called after throwing an instance of 'std::invalid_argument'
what(): Invalid AIO pin specified - do you have an ADC?
I am reading an analog input and after a while of reading the data it throws in the above error. I also ran into this same type of error when I was using PWM pins. What library am I missing or is the problem from the board itself?
Could you please tell us which version of MRAA you're using? Also, are you using the XDK or the terminal to run the code?
Are you getting this error in every program that uses an analog input or just on one specific script?
I don't think this issue has anything to do with the board, because some users have had similar messages in the past. I believe this has something to do with the library, but it would be good to have some more information.
The version of mraa that I am using is Version 0.7.2-r0. I am using the eclipse IDE to run the code. I am getting the error only on that particular program.
root@edison:~# opkg info libmraa0
Depends: libgcc1 (>= 4.9.1), python-core, libpython2.7-1.0 (>= 2.7.3), libstdc++6 (>= 4.9.1), libc6 (>= 2.20)
Status: install user not-installed
Description: Low Level Skeleton Library for Communication on Intel platforms Low
Level Skeleton Library for Communication on Intel platforms.
The first thing that I would suggest you is to update your version of mraa. Version 0.9.x is already available, https://github.com/intel-iot-devkit/mraa https://github.com/intel-iot-devkit/mraa. You could also try to change the analog pins that you're using to discard any software issue. Could you please tell me which pin you're using and how you're configuring it?
It would also be a good idea to see the program that you're using.
I am using all the analog pins on the board to get an analog reading from 5 sensors. And this is how I am configuring them
mraa::Aio* a0 = new mraa::Aio(0);
mraa::Aio* a1 = new mraa::Aio(1);
//mraa::Aio* a2 = new mraa::Aio(2);
//mraa::Aio* a3 = new mraa::Aio(3);
//mraa::Aio* a4 = new mraa::Aio(4);
adc_value0 = a0->read();
adc_value1 = a1->read();
//adc_value2 = a2->read();
//adc_value3 = a3->read();
//adc_value4 = a4->read();
cout << " " << endl;
cout << "Sensor 1: " << adc_value0 << " cm" << endl;
cout << "Sensor 2: " << adc_value1 << " cm" << endl;
//cout << "Sensor 3: " << (adc_value2*5)/10 << " cm" << endl;
//cout << "Sensor 4: " << (adc_value3*5)/10 << " cm" << endl;
//cout << "Sensor 5: " << (adc_value4*5)/10 << " cm" << endl;
And then I call the read_sensor() function every one-tenth of a second from main
Have you tried isolating each section of the code (each analog input) to determine which one is causing the issue? I see that you have some code commented out, that's why I'm asking. Also, were you able to update the mraa library?