The simulator
The Kog simulator is not a preview or a web approximation — it is the same native runtime (LVGL, the JS engine, the Kog host layer) compiled for your desktop, executing the same bytecode bundle your board would run. If it works in the sim, the rendering and logic are identical on hardware.
Using it
npm run dev # opens the simulator automatically (default target)
npx kog simulate # simulator without the dev server
The window matches your configured display (from board.yaml or kog.config.ts) — resolution, and eventually shape: round displays render round.
- Pointer: mouse acts as the touchscreen.
- Hot reload: identical to device — save and it remounts in under a second, preserving your current screen and navigation state.
- console.log: appears in your
kog devterminal, source-mapped. - Errors: compile errors overlay in the sim; runtime errors show the same error screen a device would, with the full stack in the terminal.
Virtual hardware
GPIO, ADC, and PWM work in the simulator against a virtual pin table:
- Number keys toggle configured digital input pins (so
useButton(0, ...)is testable by pressing0). - The dev server can script pin and ADC values (
setPin,setAdc) over the dev channel — useful in tests. - I2C/SPI transactions resolve through the same async path as real hardware, returning mock responses you can register.
This means an app that reads a sensor and reacts to a button can be developed end-to-end before your board arrives.