Problemas Conhecidos e suas "Soluções"

Sintoma

Erro ao compilar ou subir código para ESP32.

Problema

Traceback (most recent call last):

  File "/home/meslin/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool.py", line 34, in <module>

    import esptool

  File "/home/meslin/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/__init__.py", line 41, in <module>

    from esptool.cmds import (

  File "/home/meslin/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/cmds.py", line 14, in <module>

    from .bin_image import ELFFile, ImageSegment, LoadFirmwareImage

  File "/home/meslin/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/bin_image.py", line 14, in <module>

    from .loader import ESPLoader

  File "/home/meslin/.arduino15/packages/esp32/tools/esptool_py/4.6/esptool/loader.py", line 30, in <module>

    import serial

ModuleNotFoundError: No module named 'serial'

exit status 1


Compilation error: exit status 1

Solução

Instalar pyserial:

$ pip install pyserial

Defaulting to user installation because normal site-packages is not writeable

Collecting pyserial

  Downloading pyserial-3.5-py2.py3-none-any.whl (90 kB)

     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 90.6/90.6 KB 1.8 MB/s eta 0:00:00

Installing collected packages: pyserial

Successfully installed pyserial-3.5


Sintoma

Erro ao compilar código para ESP32.

Problema

O ESP32 não usa as convenções de nome A0, A1, etc., para pinos analógicos.

arquivo.ino:4:27: error: 'A1' was not declared in this scope; did you mean 'y1'?

  4 | const byte PIN_ANALOG_Y = A1;

   |              ^~

   |              y1

exit status 1

Compilation error: 'A1' was not declared in this scope; did you mean 'y1'?

Solução

No ESP32, devemos usar os números de GPIO diretamente:

Veja pinagem completa nessa página.