Tutorial
π‘ Tip: Disable headers/footers in your print dialog for a clean PDF.
PlatformIO in VS Code β Speedrun Setup β‘
π§ Why PlatformIO?
One editor. Many boards (Arduino, ESP32, more). Auto-libs. Clean uploads. Great for bigger projects.
Goal: open VS Code β install PlatformIO β make a Blink project β upload. Mini win unlocked. π―
π» Install VS Code + PlatformIO
- Install Visual Studio Code (your OS).
- Open VS Code β left sidebar Extensions (squares icon).
- Search βPlatformIO IDEβ β click Install.
- Restart VS Code if it asks.
β οΈ If youβre on school PCs, you may need the portable VS Code or IT help to install.
π Make a Blink Project
- Click the alien head icon (PlatformIO) β New Project.
- Name:
Blink. - Board: pick yours (e.g., Arduino Uno or ESP32 Dev Module).
- Framework: Arduino.
- Create. Wait while it sets things up.
π‘ Paste Blink Code
Open src/main.cpp and paste:
#include <Arduino.h>
void setup(){ pinMode(LED_BUILTIN, OUTPUT); }
void loop(){ digitalWrite(LED_BUILTIN, HIGH); delay(500); digitalWrite(LED_BUILTIN, LOW); delay(500); }
π‘ On ESP32, the onboard LED is often on
GPIO2. Replace LED_BUILTIN with 2 if needed.π Upload
- Plug in your board (use a data-capable USB cable).
- Bottom bar: click β (Build) β then β (Upload).
- LED blinking? You did it. π
β οΈ ESP32: If it says βFailed to connect,β hold BOOT, click Upload, release when βConnectingβ¦β shows.
π§― Quick Fixes
- No port? Try another USB cable/port; install CP210x/CH34x driver.
-
Wrong board? Edit
platformio.iniβ set the correctboard = <name>. - Serial Monitor busy? Close it before uploading.
π Next Steps
- Add libraries (PIO Home β Libraries).
- Make multiple environments for different boards.
- Try Wi-Fi examples on ESP32.
Welcome to the pro lane. ποΈ