Skip to main content

Simulation

DeviceScript provides a rich support for simulating devices and peripherals. The Visual Studio Code extension makes it easy to start and stop simulators.

DeviceScript simulator

The first simulator you use is a DeviceScript Manager device, a device capable of running the DeviceScript bytecode. It runs the DeviceScript C firmware compiled into WebAssembly. This WASM simulator will be launched by the debugger or by clicking on the plug icon in the DeviceScript pane.

Connect button in DeviceScript pane

Once started the simulator will appear in the device tree and you can explore its services and status.

simulator tree

Peripherals dashboard

The dashboard icon starts a peripheral dashboard view. It allows to visualize any connected device and also launch simulator peripherals. The simulator peripheral are typically interactive and allow to change the values using UI controls.

Dashboard

note

The dashboard requires internet access.

Custom servers

It is also possible to create peripheral simulators in "node.js TypeScript" (running in a node.js process). This technique is documented in the developer documentation.