Go Down

Topic: readAnalogResolution not in scope (Read 783 times) previous topic - next topic


Fresh install of Arduino IDE 1.6.7 and sam cores are in Appdata/local/Arduino15. Can see readAnalogResolution defined in wiring_analog.c.

I've tried installing the Sam boards other versions 1.6.5, 1.6.4, but cannot get the read resolution to work as it says it is not in scope. Tried deleting everything and going back to old versions of IDE and while everything else works readAnalogResolution isn't in scope. Am back at latest of boards and IDE.

Selected port with Due, Programmer Due, all the usual and can compile and upload no problem.

Tried compiling the CAN app Echo test of Collins and will compile. CANBUS is the reason i got the Due but i also would like the 12 bits of A/D for another application. Tried include wiring_analog.h, no help.

Checked the other posts of this problem but couldn't find a solution. Any thoughts?


exit status 1
'readAnalogResolution' was not declared in this scope


Jan 30, 2016, 06:35 pm Last Edit: Jan 30, 2016, 06:43 pm by briantee
Interestingly i changed:

static int _readResolution = 10;
static int _writeResolution = 8;


static int _readResolution = 12;
static int _writeResolution = 8;

in the sam 1.6.6 core file "wiring_analog.c" in appdata/local/arduino15....

I commented out the readAnalogResolution(12) in my little AnalogRead test pgm and voila
0 - 4096 readings. 12 bits.

While I'm probably doing something wrong, it would seem there is bug somewhere in the latest versions.

Also I've noticed posts saying the Due doesn't read full scale on the A/D converter. In my case a proper 0.00v reads 2 and 3.300v applied reads 4095 using internal reference. Close enough.


Don't do that. Change it back. That will break all of your other Arduino boards.

That error message is the compiler's way of telling you that you misspelled the name of the function.  Try analogReadResolution()
"The problem is in the code you didn't post."


Seriously, i can't believe i did that!

Go Up