Mokxi for VS Code
Write your Arduino and ESP32 sketches in VS Code, keep them in your own git
repository, and run them in Mokxi, the electronics
simulator that runs in your browser.
What it does
- 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.
- Pull gets the latest from Mokxi, and refuses to throw away edits you
have not synced.
- Open in Mokxi opens the project in the simulator, in your browser.
- Run in the Simulator runs the project on Mokxi's servers and streams the
serial output into the "Mokxi Serial" panel. It counts against your plan's
API minutes.
- 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 the simulator runs exactly what you built.
- 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.
- New Project makes a project for the board you pick.
Getting started
- Install the extension, then click the Mokxi icon in the Activity Bar.
- Press Sign In.
- Click a project to open it, or press New Project.
- Edit the sketch, then press Sync (the cloud icon on the editor's title
bar) or Run in the Simulator (the play icon).
A folder saved from Mokxi to GitHub already recommends this extension: open
it in VS Code and accept the suggestion.
Compile and upload
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. Without it, press Run in the
Mokxi editor once after syncing: the build it makes is kept with the project
and Run in the Simulator uses it.
Settings
| Setting |
What it does |
mokxi.runSeconds |
Simulated seconds Run in the Simulator runs for (default 5) |
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
the other way around.
Privacy
The extension talks only to mokxi.com (or the mokxi.apiUrl you set). It
sends your project's files when you sync, run or upload, and nothing else.
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