What documentation are you checking? I'm checking this one: mraa module — mraa v0.5.4-5-g1ee0548 documentation. There is an explanation about the class mraa.Aio and it says the value read is shifted. There is a method called setBit(int bits) to set the bit value which mraa will shift the raw reading from the ADC. According to that documentation you should set the number of bits to 0.
My bad, I did not check the documentation properly.
I will try your suggestion tonight and close this question as answered.
Turns out that the MRAA version I had was an older version which probably did not set the default #bits to 10.
It did not even have the setBit, getBit methods. This is the MRAA that came with the latest yocto image and I had not checked the MRAA version until now.
After I updated the MRAA to latest version, analog read is working fine.
Thanks Deigo for pointing me to the correct documentation. It was right there but I was somehow missing it in haste.
How did you update to the latest version ?
I have the latest yocto image installed, but this seems to be the outdated version.
You can SSH into your Edison and execute the following commands shown below in bold:
echo "src mraa-upm http://iotdk.intel.com/repos/1.1/intelgalactic" > /etc/opkg/mraa-upm.conf
opkg install libmraa0
The MRAA github page is here: https://github.com/intel-iot-devkit/mraa
You can find more information on the github page.
I hope this helps.
thanks that worked ! It is now 10-bit by default and can be set to 12-bit using setBit(), which is now exposed in the JS API (wasn't there before).