This project demonstrates how to use Wokwi with VSCode for MicroPython programming, specifically for an ESP32 microcontroller. It includes a simple example that toggles an LED when a button is pressed.
main.py
: The main MicroPython script that runs on the ESP32.diagram.json
: Wokwi diagram file that describes the hardware setup.wokwi.toml
: Configuration file for the Wokwi simulator.ESP32_GENERIC_S3-20240602-v1.22.1.bin
: ESP32 firmware file (you need to download this separately).
To use this project, you'll need:
- Visual Studio Code
- Wokwi extension for VSCode
- A Wokwi license (30-day free trial available)
- Python and pip installed on your system
-
Clone this repository:
git clone https://github.com/ESP32-Work/MicroPython_ESP32 cd MicroPython_ESP32/Led\ Blink/
-
Install the Wokwi extension in VSCode.
-
Install
mpremote
:pip install mpremote
-
Download the ESP32 firmware file (
ESP32_GENERIC_S3-20240602-v1.22.1.bin
) and place it in the project root.
-
Open the project folder in VSCode.
-
Open the
diagram.json
file and click on "Run Simulation" to start the Wokwi simulator. -
Then upload the code remotely:
python -m mpremote connect port:rfc2217://localhost:4000 run main.py
-
In the simulation, press the button to toggle the LED on and off.
- Modify
main.py
to change the behavior of the MicroPython program. - Edit
diagram.json
to change the hardware configuration. - Update
wokwi.toml
if you need to change the firmware file or server port.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.
- Thanks to Wokwi for providing the simulation platform.
- MicroPython for enabling Python on microcontrollers.