5 Replies Latest reply on Mar 16, 2016 5:46 PM by PabloM_Intel

    std::invalid_argument

    dunex_1

      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?

      Aborted

      logout

       

      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?

        • 1. Re: std::invalid_argument
          PabloM_Intel

          Hi dunex_1,

           

          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.

           

          Regards,

          Pablo

          • 2. Re: std::invalid_argument
            dunex_1

            Hi PabloM_Intel,

             

            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

            Package: libmraa0

            Version: 0.7.2-r0

            Depends: libgcc1 (>= 4.9.1), python-core, libpython2.7-1.0 (>= 2.7.3), libstdc++6 (>= 4.9.1), libc6 (>= 2.20)

            Provides: mraa

            Status: install user not-installed

            Section: libs

            Architecture: core2-32

            Maintainer: Poky <poky@yoctoproject.org>

            MD5Sum: e34c2bbf2f5484b512f4da516c2d1bbb

            Size: 457942

            Filename: libmraa0_0.7.2-r0_core2-32.ipk

            Source: git://github.com/intel-iot-devkit/mraa.git;protocol=git;rev=299bf5ab27191e60ea0280627da2161525fc8990

            Description: Low Level Skeleton Library for Communication on Intel platforms  Low

            Level Skeleton Library for Communication on Intel platforms.

            • 3. Re: std::invalid_argument
              PabloM_Intel

              Hi dunex_1,

               

              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. 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.

               

              Regards,

              Pablo

              • 4. Re: std::invalid_argument
                dunex_1

                Hi PabloM_Intel

                 

                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

                 

                global variables

                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);

                 

                void read_sensor(){

                 

                 

                     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

                • 5. Re: std::invalid_argument
                  PabloM_Intel

                  Hi dunex_1,

                   

                  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?

                   

                  Regards,

                  Pablo