Sorry - sloppy language. duplicated plus added extra function - wifi.
I'm going to ask you to provide the full verbose output from an upload.
This procedure is not intended to solve the problem. The purpose is to gather more information.
Please do this:
- Select File > Preferences... (or Arduino IDE > Settings... for macOS users) from the Arduino IDE menus.
The "Preferences" dialog will open. - Uncheck the box next to Show verbose output during:
☑compile in the "Preferences" dialog. - Check the box next to Show verbose output during: ☐ upload.
- Click the "OK" button.
The "Preferences" dialog will close. - Perform an upload, exactly as you did before.
- Wait for the upload to finish.
- Right click on the black "Output" panel at the bottom of the Arduino IDE window.
A context menu will open. - Select Copy All from the menu.
- Open a reply here on this forum topic by clicking the "Reply" button.
- Click the
<CODE/>icon on the post composer toolbar.
This will add the forum's code block markup (```) to your reply to make sure the error messages are correctly formatted.
- Press the Ctrl+V keyboard shortcut (Command+V for macOS users).
This will paste the upload output into the code block. - Move the cursor outside of the code block markup before you add any additional text to your reply.
- Click the "Reply" button to publish the post.
So you select ttyUSB0.
Showed where? Your board is not a Feather HUZZAH ESP8266. From the boards menu you should select a Mega if you want to program the Mega part of the board; not sure what to select if you want to program the ESP8266 on your board.
I think it's quite unlikely that the port would tell you that it's an Adafruit Feather HUZZAH ESP8266; that board uses a different serial-to-usb converter (CP2104 vs CH340 on you board).
Your board will not
now I get after selecting Mega
FQBN: arduino:avr:mega
Using board 'mega' from platform in folder: /home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6
Using core 'arduino' from platform in folder: /home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6
Detecting libraries used...
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/mega /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp -o /dev/null
Alternatives for Servo.h: [Servo@1.2.2 Servo@1.2.2]
ResolveLibrary(Servo.h)
-> candidates: [Servo@1.2.2 Servo@1.2.2]
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/mega -I/home/mick/Arduino/libraries/Servo/src /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp -o /dev/null
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/avr/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/mbed/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/megaavr/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/nrf52/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/renesas/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/sam/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/samd/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/stm32f4/Servo.cpp
Using cached library dependencies for file: /home/mick/Arduino/libraries/Servo/src/xmc/Servo.cpp
Generating function prototypes...
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/mega -I/home/mick/Arduino/libraries/Servo/src /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp -o /tmp/2763076635/sketch_merged.cpp
/home/mick/.arduino15/packages/builtin/tools/ctags/5.8-arduino11/ctags -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives /tmp/2763076635/sketch_merged.cpp
Compiling sketch...
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10607 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/cores/arduino -I/home/mick/.arduino15/packages/arduino/hardware/avr/1.8.6/variants/mega -I/home/mick/Arduino/libraries/Servo/src /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp -o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp.o
Compiling libraries...
Compiling library "Servo"
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/avr/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/megaavr/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/mbed/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/sam/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/nrf52/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/samd/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/stm32f4/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/renesas/Servo.cpp.o
Using previously compiled file: /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/xmc/Servo.cpp.o
Compiling core...
Using precompiled core: /home/mick/.cache/arduino/cores/arduino_avr_mega_cpu_atmega2560_68e17686be0a756bf6f65fcfe276596c/core.a
Linking everything together...
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-gcc -Wall -Wextra -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections -mmcu=atmega2560 -o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.elf /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/sketch/arduino_radar_code.ino.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/avr/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/mbed/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/megaavr/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/nrf52/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/renesas/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/sam/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/samd/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/stm32f4/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/libraries/Servo/xmc/Servo.cpp.o /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/../../cores/arduino_avr_mega_cpu_atmega2560_68e17686be0a756bf6f65fcfe276596c/core.a -L/home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6 -lm
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.elf /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.eep
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-objcopy -O ihex -R .eeprom /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.elf /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.hex
Multiple libraries were found for "Servo.h"
Used: /home/mick/Arduino/libraries/Servo
Not used: /home/mick/.arduino15/libraries/Servo
Using library Servo at version 1.2.2 in folder: /home/mick/Arduino/libraries/Servo
/home/mick/.arduino15/packages/arduino/tools/avr-gcc/7.3.0-atmel3.6.1-arduino7/bin/avr-size -A /home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.elf
Sketch uses 5624 bytes (2%) of program storage space. Maximum is 253952 bytes.
Global variables use 340 bytes (4%) of dynamic memory, leaving 7852 bytes for local variables. Maximum is 8192 bytes.
"/home/mick/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/bin/avrdude" "-C/home/mick/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf" -v -patmega2560 -cwiring "-P/dev/ttyS0" -b115200 -D "-Uflash:w:/home/mick/.cache/arduino/sketches/3E3E75602A140F56F76CE262C4FCD9E6/arduino_radar_code.ino.hex:i"
avrdude: Version 6.3-20190619
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
Copyright (c) 2007-2014 Joerg Wunsch
System wide configuration file is "/home/mick/.arduino15/packages/arduino/tools/avrdude/6.3.0-arduino17/etc/avrdude.conf"
User configuration file is "/home/mick/.avrduderc"
User configuration file does not exist or is not a regular file, skipping
Using Port : /dev/ttyS0
Using Programmer : wiring
Overriding Baud Rate : 115200
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_ReceiveMessage(): timeout
avrdude: stk500v2_getsync(): timeout communicating with programmer
avrdude done. Thank you.
Failed uploading: uploading error: exit status 1
Assuming that you're using the Mega+ESP8266, check the dipswitches; you might have set them for communication with the ESP8266.
I wish you would have followed my instructions. You are establishing a clear pattern of not providing the information the helpers here request of you. That sort of behavior is not respectful of our time, and is also not productive for you.
The reason I wanted to get that output is because if you truly did successfully upload to the board while you had an ESP8266 board selected, this means you had the DIP switches on the board in the configuration where the PC is communicating directly with the ESP8266 microcontroller. If you successfully uploaded a sketch while the board was in that configuration, you overwrote the "AT" firmware that is installed on the ESP8266 when you get the board from the factory.
Overwriting the ESP8266's "AT" firmware is problematic because the most common use case for this board is to run your program on the ATmega2560, with the ESP8266 is used only as a Wi-Fi communication adapter. The AT firmware is what allows the ATmega2560 to control the ESP8266, and transmit and receive data via the Wi-Fi network connection. For example, the "WiFiEsp" library I recommended in post #2, and likewise the "WiFiEspAT" library @Juraj recommended in post #6 require the ESP8266 to have the "AT" firmware installed.
Unfortunately replacing the "AT" firmware is not as simple as erasing it. The reason is that the firmware is not available as an Arduino sketch, and so you can't use Arduino IDE to upload the firmware to the ESP8266. You must follow a different procedure. I haven't done this for years, but I believe the procedure is documented here:
Checked dip switches 1=off, 2=off, 3=on, 4=off, 5=off, 6=0ff, 7=off, 8 was on now switched off
switch 8 is described as no connect.
This is getting beyond what I can focus on at present.
My thanks to ptillisch and sterretje for there assistance and apologies for failing follow their instructions.
mick
The manual for the Duinotech MEGA 2560 r3 Main Board with Wi-Fi: https://media.jaycar.com.au/product/resources/XC4421_manualMain_91721.pdf
From that:

