Mokxi for VS Code
Run your Arduino, ESP32 and Pico circuits in a simulator panel inside VS Code,
test them with scenarios in the Test Explorer, and keep them in your own git
repository. Mokxi projects and Wokwi projects (wokwi.toml and
diagram.json) both work.
The simulator, inside VS Code
- Start Simulator (the play icon on a sketch,
diagram.json or
wokwi.toml) opens the circuit beside your code, running on
Mokxi's own engine. Displays draw, LEDs light, and
serial output streams as it runs.
- Serial monitor: a "Mokxi Serial Monitor" terminal shows what the boards
print. Type a line and press Enter to send it.
- Start, Stop and Restart from the panel's title bar, the status bar, or
the Command Palette.
- Live on save: save a sketch, the diagram or
wokwi.toml, or let your
build tool write a new firmware file, and the panel runs it again.
- Your build or ours: a project with a build (the ELF or firmware
wokwi.toml names, a PlatformIO build, or an arduino-cli build from
Compile) runs that build. A sketch with no build is compiled for you, by the
same compiler the Mokxi editor uses.
Tests, lint and screenshots
These are the mokxi command line's own commands, so a result in VS Code is
the result CI gets.
- Test Explorer: every
mokxi.test.yaml, *.test.yaml and
*.scenario.yaml (Wokwi's scenario format works unchanged) shows up in the
Testing view. Each scenario is a test and each step is under it, passed or
failed at its own line, with the failing step's message and the last serial
lines.
- Check the Circuit (Lint): wiring mistakes and parts Mokxi does not
simulate show in the Problems panel, on the line of the part. It runs when
you save the diagram too.
- Screenshot a Display: runs the circuit to the moment you pick and saves
the display as a PNG of its own pixels (or the whole circuit as an SVG), in
screenshots/.
- Set Up CI writes the GitHub Actions workflow
(
.github/workflows/mokxi.yml), the GitLab CI file, or both, and a first
mokxi.test.yaml if the project has none. CI is free for public
repositories; a private one needs a CI token from Pro for work in the
MOKXI_TOKEN secret.
The simulator, tests, lint, screenshots, Set Up CI and Compile run on your
machine and need no account. The simulator panel loads its page from
mokxi.com, so it needs a network connection; the first compile downloads the
compiler once (about 70 MB, kept in ~/.cache/mokxi, shared with the CLI).
Your Mokxi projects (Pro)
- Sign in with a short code you approve at mokxi.com/device, or paste a
token from Settings > Developer. The token is kept in your operating
system's keychain (VS Code's SecretStorage), never in settings.
- Your projects in the Mokxi sidebar. Click one to open it as a folder:
the sketch as an Arduino IDE folder (
Blink/Blink.ino plus its tabs), the
whole circuit as diagram.mokxi.json, a README and .vscode/ settings.
- Sync sends your edits to Mokxi. It refuses to overwrite newer work done
in the browser and tells you so. A project you create this way starts
private, like every Mokxi project. Sharing a link is free and Public (the
gallery) is your choice: both are in the Share menu in the editor.
- Pull gets the latest from Mokxi, and refuses to throw away edits you
have not synced.
- Open in Mokxi opens the project in the browser editor. There, Upload
to board writes the sketch to a real board over USB from Chrome or Edge
(Arduino AVR boards such as the Uno, Nano and Mega, ESP32 and ESP8266
boards, and the Blue Pill), and Download for your board gives a .uf2
file for the Pico and other drive boards.
- Compile runs
arduino-cli as a VS Code task, so errors land in the
Problems panel. Compile and Upload to Mokxi syncs, compiles and stores
the build with the project, so mokxi.com runs exactly what you built.
- New Project makes a project for the board you pick.
Opening, syncing, pulling and uploading are part of Pro (or the student
price, Teacher, Classroom, Pro for work, or the free trial).
Build circuits with AI
Mokxi's MCP server, https://mokxi.com/mcp, lets an AI app (Claude, ChatGPT,
Cursor, VS Code with GitHub Copilot and others) build a project from a
sentence and hand back a link that opens it in Mokxi. Setup steps are at
https://mokxi.com/docs/account/mcp-server. Save the project in the editor and it shows up in the Mokxi
sidebar here, ready to open as a folder.
Arduino syntax and snippets
.ino files get C++ highlighting plus the Arduino core's functions and
constants, and snippets such as sketch, blink, button, every and
interrupt.
Compile with arduino-cli
Compile needs arduino-cli with the
core for your board (for an Uno, arduino-cli core install arduino:avr). Set
mokxi.arduinoCliPath if it is not on your PATH. You do not need it for the
simulator panel, which compiles a sketch itself.
Settings
| Setting |
What it does |
mokxi.reloadOnSave |
Rerun the simulator when the project changes (default on) |
mokxi.lintOnSave |
Lint the circuit when the diagram is saved (default on) |
mokxi.projectsFolder |
Where Open Project and New Project put folders |
mokxi.arduinoCliPath |
The arduino-cli command |
mokxi.projectId |
The project a folder is (set for you) |
mokxi.apiUrl |
The API, for a local development server only |
The command line
Everything here is also in the mokxi command line tool (npx @mokxi/cli),
and the two share their files: a folder opened here works with mokxi push
and mokxi test, and the other way around.
Privacy
The extension talks to mokxi.com (or the mokxi.apiUrl you set). The
simulator panel loads mokxi.com's simulator page and hands it the circuit in
the browser view; nothing is saved. Your project's files are sent only when
you sync or upload. Class accounts for students under 13 are not meant to use
it unless their teacher says so.
Docs: https://mokxi.com/docs/editor/github-and-vs-code