9 Replies Latest reply on Mar 3, 2016 11:41 PM by tulasi_yeditha

    mraa gpio as analog input

    pform

      Hi,

       

      I wish to use GPIO 44 through 47 as analog inputs. At present I am using the mraa library and node.js (although a python example will be fine).

       

      According to MRAA docs mraa: Intel Edison then to use GPIO 44 (MRAA pin 14) then I need to call mraa_gpio_init(14) although I have not been able to find the python/js equivalent?

       

      The next problem is then after the GPIO declaration above do I have to specify this then as an analog input? Do I have to specify the direction?

       

      var pin = m.Gpio(14);         //does this initialise the MRAA pin 14 (GPIO 44) to A0?

      var a0 = new m.Aio(pin);   // do I then use it like this

       

      I can this error :

       

      module.js:456

        return compiledWrapper.apply(self.exports, args);

                               ^

      Error: in method 'new_Aio', argument 1 of type 'unsigned int'

       

      or when I substitute 0 then I get this error:

      var a0 = new m.Aio(0);                                   

       

      module.js:456

        return compiledWrapper.apply(self.exports, args);

                               ^

      Error: Invalid AIO pin specified - do you have an ADC?

       

       

      Any pointers would be great.

       

      Many Thanks.

      Pform