Software Setup ‐ VS Code with PlatformIO - tildemark/ESP32-OLED-GME12864-78 GitHub Wiki
Software Setup - VS Code with PlatformIO
This page provides instructions on setting up VS Code with PlatformIO for ESP32 and OLED display development.
1. Install VS Code
- Download and install VS Code: https://code.visualstudio.com/
2. Install PlatformIO IDE Extension
- Open VS Code.
- Go to Extensions and search for "PlatformIO IDE".
- Install the extension and restart VS Code.
3. Create a New Project
- Click the PlatformIO icon on the Activity Bar.
- Click "New Project".
- Enter a Project Name.
- Select your ESP32 board.
- Select "Arduino" as the framework.
- Click "Finish".
4. Install Libraries
- In the PlatformIO sidebar, go to "Libraries".
- Search for "Adafruit SH110X" and install it.
- Search for "Adafruit GFX Library" and install it.
platformio.ini
5. Configure - In the PlatformIO Home screen, navigate to the "Libraries" section.
- Search for "Adafruit SH110X" and install the "Adafruit SH110X by Adafruit" library.
- Search for "Adafruit GFX Library" and install the "Adafruit GFX Library by Adafruit" library.
platformio.ini
file:
5. Modify the - PlatformIO will automatically install the specified libraries when you build the project.
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
adafruit/Adafruit SH110X@^2.1.12
adafruit/Adafruit GFX Library@^1.12.0
monitor_speed = 115200
monitor_port = COM[Your COM Port] # Replace with your COM port
- For Windows Users:
- To determine your ESP32's COM port:
- Open Device Manager (right-click Start, select Device Manager).
- Expand "Ports (COM & LPT)".
- Note the COM port number (e.g., COM3) associated with your ESP32.
- Replace
COM3
with the correct COM port.
- To determine your ESP32's COM port:
6. Upload Code to ESP32 (Windows)
- Connect your ESP32 to your Windows computer via USB.
- Ensure your
platformio.ini
file has the correctmonitor_port
setting (see step 5). - Build the Project: In the PlatformIO toolbar, click the "Build" button (checkmark icon).
- Upload the Firmware: In the PlatformIO toolbar, click the "Upload" button (right-arrow icon).
- PlatformIO will upload the firmware to your ESP32.
- Troubleshooting (Windows):
- If your ESP32 doesn't appear in Device Manager, install the appropriate USB-to-serial drivers (e.g., CH340 drivers).
- Close any other programs using the COM port.
- Try a different USB cable.
- Ensure the correct ESP32 board is selected in
platformio.ini
.
7. Serial Monitor
- Click "Monitor" to view serial output.
Notes
- Verify
platformio.ini
settings. - Ensure the correct COM port is used.
- The
lib_deps
section inplatformio.ini
automatically installs the needed libraries.