Error compiling for board Arduino/Genuino Mega or Mega 2560.

I knew there are few posts on this error. But neither of them work for my case. It keeps showing the same error even after I install the AVR version to 1.6.21.
Any help on this would be great!

Hi, we like to know more.
Which sketch do you use and which error do you get.
You can turn on the extra output for compiling in the settings. Then you can copy the output can put it in your post.

Why do you use such an old version. The current version of the Arduino IDE is 1.8.13.

Do you use something else ? because "the AVR" seems as a mistake.

I think 1.6.21 is the boards version, not the IDE; I don't think there ever was a 1.6.21 IDE :wink:

And I'm still using boards 1.6.21 on IDE 1.8.5 :smiley: If it ain't broke, don't fix it.

"Error compiling for board Arduino/Genuino Mega or Mega 2560." means that there is an error of some type somewhere in the code, without telling us anything about what actually caused the error. You can scroll up in the error window to see more specific information.

In the Arduino IDE, in Files>Preferences, under "Show verbose output during:" make sure the box for "compilation" is checked, then copy and paste the contents of the error windows on here.

sterretje:
IDE 1.8.5 :smiley:

In my opinion, always the latest version should be used. Have you seen what you miss ? https://www.arduino.cc/en/Main/ReleaseNotes.

  • Compiler errors now have both column and line
  • Fix UTF8 related bugs on Windows
  • Bundle new avr toolchain
  • updated AVR core
  • Upgraded avr-gcc to 7.3.0-atmel3.6.1-arduino7
  • Wire class now supports timeout

Hi,
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".
OR
http://forum.arduino.cc/index.php/topic,148850.0.html.
Then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

Koepel:
In my opinion, always the latest version should be used. Have you seen what you miss ?

The stuff mentioned has not been bothering me :wink:

This one is super awesome:

The boards in the boards list in the "Tools" menu are now grouped by platform. This should make the selection
easier when there are lots of boards loaded in the IDE. (thanks @matthijskooijman)

Hi there! Sry for the late reply. Below is the error messages.
I am using the code from : GitHub - pulsartronic/LoRaWANGatewaySC: LoRa WAN Single Channel Gateway
Hope can get help from you all. Thanks!

In file included from C:\Users\ASUS\AppData\Local\Temp\arduino_build_360564\sketch\LoRaWanGateway.h:9:0,
from C:\Users\ASUS\Desktop\FYR\arduino file\LoRaWANGatewaySC-master\LoRaWANGatewaySC-master\LoRaWanGateway\LoRaWanGateway.ino:1:
C:\Program Files (x86)\Arduino\libraries\Login/Login.h:4:10: fatal error: FS.h: No such file or directory
#include <FS.h>
^~~~~~
compilation terminated.
Using library Debug in folder: C:\Program Files (x86)\Arduino\libraries\Debug (legacy)
Using library Application in folder: C:\Program Files (x86)\Arduino\libraries\Application (legacy)
Using library ArduinoJson at version 6.11.0 in folder: C:\Program Files (x86)\Arduino\libraries\ArduinoJson
Using library Login in folder: C:\Program Files (x86)\Arduino\libraries\Login (legacy)
Using library SystemClock in folder: C:\Program Files (x86)\Arduino\libraries\SystemClock (legacy)
exit status 1
Error compiling for board Arduino Mega or Mega 2560.

Hi @stephanie9. Good to hear from you again.

The reason for this error is that code is only compatible with the ESP8266 boards. You are compiling for the Arduino Mega, which is not compatible with that code. Note that there are two different ways to use the ESP8266:

  • Using the ESP8266 as a standalone Arduino board, where you are uploading your sketch directly to the ESP8266 microcontroller.
  • Using the ESP8266 as a WiFi adapter connected to a standard Arduino board such as the Mega. In this case, you are uploading sketches to the standard Arduino board, which is communicating with the ESP8266 module (usually over serial).

The sketch you found can only be used with the first style of using the ESP8266.

But I am not even connecting my Arduino board while compiling this. So would it be the issue in this case too?

Yes. It makes no difference whether the board is connected to your computer or not. This is an error when the compiler on your computer is trying to compile the sketch on your computer into a binary on your computer.

I see, thanks! btw, there is another question from me, my serial monitor is not showing the result I want in this laptop but it works in another laptop. It only shows the time on the serial monitor. Does sir know what is the exact problem? I am not sure if is there any settings I change that causes this...

The problem is probably that you have the baud rate mismatched between the sketch and the Serial Monitor. In your sketch, the baud rate is set via Serial.begin(), something like this:

Serial.begin(9600);

You must have Serial Monitor set to the same baud rate. So if your board was running a sketch with the line shown above, you would need to select "9600" from the baud rate menu near the bottom right corner of Serial Monitor.

ahh I see. Thanks! It solved my problem :smiley: :smiley:

You're welcome. I'm glad to hear it's working now. Enjoy!
Per

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.