How to Use Wokwi in VS Code for ESP32
Introduction
Wokwi is a powerful online simulator for ESP32
development, but did you know you can also use it directly in Visual Studio
Code (VS Code)? This setup provides a smoother workflow with better debugging
and coding tools.
In this guide, you’ll learn how to:
✅ Install Wokwi in VS Code
✅ Create and simulate ESP32 projects
✅ Debug and run your code
Step 1: Install VS Code
If you haven’t already installed VS Code, download it
from:
🔗 https://code.visualstudio.com/
After installation, open VS Code and proceed to the next
step.
Step 2: Install Wokwi Extension
- Open
VS Code and go to the Extensions Marketplace (Ctrl + Shift + X).
- Search
for “Wokwi Simulator”.
- Click
Install to add the extension.
✅ The Wokwi extension allows you
to simulate ESP32 projects directly inside VS Code.
Step 3: Create a New Wokwi ESP32 Project
- Open
VS Code.
- Press
Ctrl + Shift + P to open the command palette.
- Type
“Wokwi: New ESP32 Project” and select it.
- Choose
a folder where you want to save your project.
This will create the necessary project files, including:
- main.cpp
(for your ESP32 code)
- wokwi.toml
(configuration file)
Step 4: Writing ESP32 Code in VS Code
Open main.cpp and replace its content with the following basic ESP32 code:
Step 5: Running the Wokwi Simulation
- Open
the command palette (Ctrl + Shift + P).
- Type
“Wokwi: Start Simulation” and select it.
- The
Wokwi simulator will launch, showing the ESP32 board and a Serial Monitor.
✅ You will see the output:
Step 6: Adding Components (LED, Sensors, etc.)
You can edit the wokwi.toml file to add components like
LEDs, buttons, or sensors.
Example: Adding an LED
Edit wokwi.toml and add:
Now, when you run the simulation, an LED will blink!
Step 7: Saving and Sharing Your Project
To share your project, simply upload the project folder
to GitHub or zip it for others to download.
Conclusion
Using Wokwi in VS Code gives you:
🚀 A better coding experience
🔍 Advanced debugging tools
🔗 Direct integration with Wokwi’s powerful
simulation
Now you can develop ESP32 projects more efficiently without leaving VS Code!
0 Comments