This post shows a solution to the espcomm_open failed error after clicking Upload on Linux. It also shows how to cause this error.
Symptom
After clicking Upload you see this error:
Arduino: 1.8.7 (Linux), Board: "WeMos D1 R2 & mini, 80 MHz, 921600, 4M (3M SPIFFS)"
Sketch uses 225289 bytes (21%) of program storage space. Maximum is 1044464 bytes.
Global variables use 32140 bytes (39%) of dynamic memory, leaving 49780 bytes for local variables. Maximum is 81920 bytes.
warning: espcomm_sync failed
error: espcomm_open failed
error: espcomm_upload_mem failed
error: espcomm_upload_mem failed
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
A Solution
1. Open a terminal
2. Type fuser /dev/ttyUSB0
You should see something like:
/dev/ttyUSB0: 28988
3. Type kill -9 28988 (replace 28988 with the actual number listed)
4. Click Upload again
You should see something like:
Sketch uses 225289 bytes (21%) of program storage space. Maximum is 1044464 bytes.
Global variables use 32140 bytes (39%) of dynamic memory, leaving 49780 bytes for local variables. Maximum is 81920 bytes.
Uploading 229440 bytes from /tmp/arduino_build_91017/sketch_nov03a.ino.bin to flash at 0x00000000
................................................................................ [ 35% ]
................................................................................ [ 71% ]
................................................................. [ 100% ]
Cause Problem
In another terminal type minicom (follow [link])
Click Upload, you'll see the error
Reference
Arduino icon clipped from [link]