1

I wrote an code on Arduino and I getting compilation errors. I am using Arduino Due . I wrote the following code :

void setup() {
  Serial.begin(9600);
  analogWriteResolution(12);  // set the analog output resolution to 12 bit (4096 levels)
  analogReadResolution(12);   // set the analog input resolution to 12 bit


}

void loop() {

  // code
}

But compiler gave me the following errors :

'analogReadResolution’ was not declared in this scope
‘analogWriteResolution’ was not declared in this scope
‘DAC0’ was not declared in this scope

I'm using Arduino 2:1.0.5 (on Linux). The board list doesn't show Arduino Due (USB programmable).And I don't have Board Manager option. How do I install Arduino SAM Board to compile the program ?

  • Did you try to update the Arduino library/IDE? Afaik the analogRead/WriteResolution functions should be known. – Michel Keijzers Jun 9 '17 at 8:57
  • I installed it today itself and it v2:1.0.5. If I have to update the it through terminal how do i go about it ? – Sam Thornton Jun 9 '17 at 9:02
  • In case you installed it, it is not needed to update. – Michel Keijzers Jun 9 '17 at 15:41
2

According to the Arduino - ReleaseNotes,

ARDUINO 1.5 BETA - 2012.10.22

  • First release for the unified IDE for both AVR 8-bit and ARM 32-bit (SAM3 CPUs) architectures.
  • This release include the SAM Arduino Core used in the Arduino Due Board.

So your 1.0.5 version does not allow for Due compilation. Download the most up-to-date version and you will be fine (you will be able to install SAM support).

Then you will be able to at least compile. If you have other problems with your code, please open another question here (in order to keep the one-question-per-post behavior of this website).

Don't install arduino from the debian repository, since that version is not updated regularly. Use the website version

  • I updated it to the latest version but I still can't find the Arduino Due board. When I select the board manager option it throws an error saying Error downloading http://downloads.arduino.cc/packages/package_index.json – Sam Thornton Jun 9 '17 at 9:39
  • @SamThornton did you try google? Most of the times other users report this is 1) a spyware, 2) a connection issue, 3) a JAVA misconfiguration. I think 1 is not applicable to linux. Try accessing the file from a browser (if you can't it is an internet issue). Or verify if you are behind a proxy. As a last resource, purge the old arduino install, clean the new one and then reinstall, reboot and try again – frarugi87 Jun 9 '17 at 9:53
  • I finally found the error. It was due to the fact that the Linux was set on Automatic Proxy. – Sam Thornton Jun 9 '17 at 18:32
  • @SamThornton good to know ;) Glad you managed to fix it – frarugi87 Jun 9 '17 at 19:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.