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– Michel Keijzers2017年06月09日 08:57:37 +00:00Commented Jun 9, 2017 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– Sam Thornton2017年06月09日 09:02:55 +00:00Commented Jun 9, 2017 at 9:02
-
In case you installed it, it is not needed to update.Michel Keijzers– Michel Keijzers2017年06月09日 15:41:37 +00:00Commented Jun 9, 2017 at 15:41
1 Answer 1
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– Sam Thornton2017年06月09日 09:39:58 +00:00Commented Jun 9, 2017 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 againfrarugi87– frarugi872017年06月09日 09:53:26 +00:00Commented Jun 9, 2017 at 9:53
-
I finally found the error. It was due to the fact that the Linux was set on Automatic Proxy.Sam Thornton– Sam Thornton2017年06月09日 18:32:14 +00:00Commented Jun 9, 2017 at 18:32
-
@SamThornton good to know ;) Glad you managed to fix itfrarugi87– frarugi872017年06月09日 19:15:49 +00:00Commented Jun 9, 2017 at 19:15