Kadang saat kita memprogram Arduino akan muncul error di jendela debug di bagian bawah Arduino IDE. Dengan demikian kita jadi tahu apa yang menyebabkan error dan mengambil langkah untuk menanggulangi error tersebut. Berikut ini beberapa error yang sempat saya catat. Ntar saya update terus jika menemui error message yang lain Show
Error Message 1 :Sketch uses 928 bytes (2%) of program storage space. Maximum is 32,256 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes. avrdude: stk500_recv(): programmer is not responding avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x78 avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x30 avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x20 avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x30 Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions. Solusi : biasanya error di atas muncul karena pin 0 dan 1 Arduino Uno ada jumperan kabel ke sistem Anda yang lain. Coba copot dulu kabel tersebut [AdSense-B] Error message 2 :Arduino: 1.6.12 (Windows 7), Board: “Arduino/Genuino Uno” \arduino 1.0.5\DHT11\DHT11.ino:1:17: fatal error: dht.h: No such file or directory #include <dht.h> ^ compilation terminated. exit status 1 Error compiling for board Arduino/Genuino Uno. This report would have more information with “Show verbose output during compilation” option enabled in File -> Preferences. Solusi : error di atas terjadi karena library dht.h tidak dapat dicari oleh compiler Arduino IDE. Coba download library yang error tersebut dan copy-kan ke folder C:/Program Files/Arduino/libraries (berlaku juga untuk library yang lain) Error Message 3 :Arduino: 1.6.5 (Windows 7), Board: “Arduino Mega ADK” Build options changed, rebuilding allc:/program files/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr6\libc.a(isspace.o): In function `isspace’: (.text.avr-libc+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__ctype_isfalse’ defined in .text.avr-libc section in c:/program files/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr6\libc.a(cty_isfalse.o) collect2.exe: error: ld returned 1 exit status Error compiling. This report would have more information with “Show verbose output during compilation” enabled in File > Preferences. Solusi : error di atas terjadi saat saya menggunakan perintah String.toFloat() di Arduino Mega. Pusing juga nyari kesalahannya di mana, karena ketika saya compile untuk board Arduino Uno ngga ada masalah. Pusing karena lama ngga nemu-nemu solusinya, akhirnya saya update aja Arduino IDE saya dari versi 1.6.5 ke 1.6.12 (versi terakhir saat tulisan ini dibuat). Iseng-iseng berhadiah, kata saya dalam hati. Eh, ngga taunya problem solved. Ya udah, Alhamdulillah 🙂 Error Message 4 :C:\Program Files\Arduino\libraries\TimeAlarms/TimeAlarms.h:72:31: error: ‘timeDayOfWeek_t’ does not name a type AlarmID_t alarmRepeat(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler); // as above, with day of week ^ C:\Program Files\Arduino\libraries\TimeAlarms/TimeAlarms.h:76:29: error: ‘timeDayOfWeek_t’ does not name a type AlarmID_t alarmOnce(const timeDayOfWeek_t DOW, const int H, const int M, const int S, OnTick_t onTickHandler); // as above, with day of week ^ exit status 1 Error compiling for board Arduino Mega ADK. Solusi : Update library TimeAlarms.h yang terbaru Error Message 5Sebenarnya ini bukan error ya, hanya warning aja, bahwa dynamic memori Anda (SRAM) sudah terpakai lebih dari 75% yang dapat menyebabkan program berjalan tidak stabil Sketch uses 12,628 bytes (39%) of program storage space. Maximum is 32,256 bytes. Solusi : kurangi pemakaian script yang menggunakan dynamic memory/SRAM seperti penggunaan variabel ‘String’, kurangi menge-print karakter di Serial Monitor (Serial.println), atau ganti board arduino Anda menjadi Arduino Mega (solusi terakhir). Untuk lebih detail cara menghemat dynamic memory Arduino akan saya tulis dalam tutorial berikutnya. [AdSense-B] Error Message 6Problem: ‘setSyncProvider’ was not declared in this scope Solusi : Instal library Time.h. Copy ke folder libraries (C:/Program Files/Arduino/Libraries) atau satu folder dengan sketch Arduino Anda Error Message 7Problem : SimpleTimer.h:37:22: fatal error: functional: No such file or directory. Biasanya karena Anda habis instal IDE Arduino terbaru Solusi : buang library SimpleTimer yang lama, ganti dengan yang ini https://github.com/jfturcot/SimpleTimer Demikian beberapa catatan saya tentang error message di Arduino IDE. Kalo nemuin lagi yang lain saya update di artikel ini. Semoga bermanfaat bagi siapa saja yang menemui masalah yang sama.
When programming the Arduino learners come across various types of errors and sometimes it becomes difficult to troubleshoot the error code. The error codes mostly come when the Arduino program is compiled, and these errors are displayed in the output menu of the Arduino IDE which is at the bottom of the software. The Arduino IDE also indicates on which line of the code the error exists and it also suggests suitable actions for rectifying the error. The most common error beginners face is the “not declared in this scope” and we have discussed why such type of error arises and how we can fix this error. What is “not declared in this scope” errorAs from the name we can understand that when the compiler of Arduino IDE is unable to recognize any variable or is unable to process any loop or any instruction having any undeclared variable so it gives the error “not declared in this scope”, which means that code is unable to understand the instruction given in the Arduino code. The Arduino IDE has a feature that it automatically indicates the line of the program which contains errors simply by underlining them with red color even before the code is compiled. Situations when the compiler gives the error “not declared in this scope”To illustrate when the error of not declaring in this scope arises in the Arduino program we have given an example code in which this type of error was encountered. For simplicity we have compiled an Arduino code which performs an addition operation and the image of the code for the simple addition having the error is posted below: When we compiled this code we got the error “b is not declared in this scope“ as it can be seen in the image posted below. As you can see that the compiler also identified the line which has the error and also it has indicated that the variable “b” is out of the scope in the program. We have posted an image below in which you can clearly see that the Arduino IDE has highlighted the variable that it is unable to understand. How to fix “not declared in the scope” errorTo fix the error we simply just declare that variable so that the compiler can understand the variable used in the code. So always remember to declare the variable you want to use in the Arduino program. We have posted the correct code after removing this error: We have successfully compiled the code and it can be seen from the image of the output menu of the Arduino IDE: And the output of the code shown in the serial monitor is: ConclusionIn Arduino programming while compiling the code one can encounter a whole bunch of error codes but these errors can be fixed by avoiding the mistakes in the first place. However, there are some errors which are due to the incorrect syntax used for programming and some are the logical errors. Although the chances of logical errors are minimal. The most common errors that are encountered by the users are related to syntax or declaration errors. So, we have described what are the declaration errors and how they arise and how we can remove them with the help of simple Arduino example code. |