Hello,
I'm Trying this code(Click Here)
And i got this message:
exit status 1
'analogReadResolution' was not declared in this scope
But i am wondering what is wrong, I have the right board selected:
Wich is "Arduino Diecimila or Duemilanove w/ ATmega168" or "Arduino Duemilanove w/ ATmega328",
But still wrong.
Knowing that my Serial value communication is okay, and analog pins are inputs per defect, can't see the problem in this code..
void setup() {
// open a serial connection
Serial.begin(9600);
}
void loop() {
// read the input on A0 at default resolution (10 bits)
// and send it out the serial connection
analogReadResolution(10);
Serial.print("ADC 10-bit (default) : ");
Serial.print(analogRead(A0));
// change the resolution to 12 bits and read A0
analogReadResolution(12);
Serial.print(", 12-bit : ");
Serial.print(analogRead(A0));
// change the resolution to 16 bits and read A0
analogReadResolution(16);
Serial.print(", 16-bit : ");
Serial.print(analogRead(A0));
// change the resolution to 8 bits and read A0
analogReadResolution(8);
Serial.print(", 8-bit : ");
Serial.println(analogRead(A0));
// a little delay to not hog Serial Monitor
delay(100);
}
This is on Youtube, it exposes part of the solution:
Half of the solution(Click Here)
SOLUTION
To solve the problem of code compilation, and to enable the option shown in the video, you need to go to Tools->Board Manager-> and download the Arduino Sam Boards (32 bits ARM Cortex-M3) by Arduino, Once you download it, the option "Arduino Due (Programming port)" will appear at the end of the Board Manager list, click that option, and then the code will compile.
I had searched the option shown in the video in the card manager, but i dind't, so messing around in the IDE, specifically, the board manager, reading several options about Arduino DUE, I tried this one, and it worked perfectly!
Now the code runs. Go try it.
I also tried this before posting, but didn't find the solution, so i posted it, hoping for help, but i kept trying on my own, until i solved it. I'm leaving this post right here so others can know the solution in the future.
Thanks to @Andr.oid Eric for posting that video, it helped.
analogReadResolution.ino (806 Bytes)