Please see the deprecation notice for details.
Make without limit! Device Simulator Express, a Microsoft Garage project, allows you to code microcontrollers without the hardware on hand! You can program your Adafruit Circuit Playground Express (CPX), your BBC micro:bit or the Adafruit CLUE! Test and debug your code on the device simulator and see the same result when you plug in your actual microcontroller. Curious about the output of the device, the serial monitor allows you to observe the device output.
- Devices we support
- Prerequisites
- Adafruit Circuit Playground Express (CPX) Simulator
- BBC micro:bit Simulator
- Adafruit CLUE Simulator
- How to use
- Contribute
- Provide feedback
- Privacy and Telemetry Notice
- Third Party Notice
- Troubleshooting Tips
- License
- Notes
| Branch | Build Status |
|---|---|
| dev | |
| staging | |
| master |
The following dependencies are required to install before launching Device Simulator Express.
You will be prompted to install the Python dependencies during the first use.
- Visual Studio Code
- Python 3.7+: Make sure you've added Python and pip to your PATH in your environment variables. (1)
- Python VS Code extension: This will be installed automatically from the marketplace when you install Device Simulator Express.
- IntelliSense and syntax highlighting for CircuitPython code for the CPX library
- Template file generation
- Integrated Python Debugging for the Simulator
- Serial monitor (available on Windows and Mac only)
- Output panel for the simulator
- Deploy CircuitPython code to the physical device.
- Simulation of the CPX device, including:
- Green LED
- Red LED
- Push Buttons A and B
- Slider Switch
- Speaker: Play .wav file
- 10 NeoPixels
- Light sensor
- Motion sensors
- Acceleration detection
- Device shake detection
- Temperature sensor
- 7 Capacitive Touch sensors
The simulator supports most of the sensors on CPX except IR transmitter & Receiver, Sound Sensor (microphone), Speaker (Play Tone) and the "tap" on Motion Sensor.
The code related to these sensors can still run on the actual CPX board and be deployed using Device Simulator Express.
As we only support CPX library now, other libraries (i.e. simpleio) can’t run on the simulator. But they will work on the actual device!
- Tutorials and Example Code for Adafruit CPX:
- Format Adafruit CPX device:
In Device Simulator Express, you can use keyboard to interact with the device:
- Push Button: A for Button A, B for Button B, C for Buttons A & B
- Capacitive Touch Sensor: Shift + 1 ~ 7 for GPIO pins A1 - A7
- Slider Switch: Shift + S
- Refresh the simulator: Shift + R
- Run the simulator: Shift + F
- IntelliSense and syntax highlighting for MicroPython code for the micro:bit library
- Template file generation
- Integrated Python Debugging for the Simulator
- Deploy MicroPython code to the physical device
- Serial monitor (available on Windows and Mac only)
- Simulation of the micro:bit device, including:
- 25 LEDs
- Push Buttons A and B
- Light sensor
- Motion sensors
- Acceleration detection including gesture detection
- Temperature sensor
- Tutorials and Example Code for BBC micro:bit:
- Push Button: A for Button A, B for Button B, C for Buttons A & B
- Refresh the simulator: Shift + R
- Run the simulator: Shift + F
- IntelliSense and syntax highlighting for CircuitPython code for the following drivers and libraries:
adafruit_clueadafruit_slideshowadafruit_display_shapesadafruit_display_textadafruit_bitmap_fontadafruit_fancyledneopixeldisplayio
- Template file generation
- Integrated Python Debugging for the Simulator
- Deploy CircuitPython code to the physical device
- Serial monitor (available on Windows and Mac only)
- Simulation of the CLUE device, including:
- 240x240 color screen
- Push Buttons A and B
- Sensors for:
- Temperature
- Light
- Color
- Acceleration
- Humidity
- Pressure
- Proximity
- Gestures
- Gyro
- Magnetic Field
- Tutorials and Example Code for Adafruit CLUE:
- Push Button: A for Button A, B for Button B, C for Buttons A & B
- Refresh the simulator: Shift + R
- Run the simulator: Shift + F
To use Device Simulator Express, install the extension from the marketplace and reload VS Code.
To access many of the commands, you need to open the command palette. This can be done with Ctrl + Shift + P for Windows and Linux / Cmd + Shift + P for Mac. It can also be accessed from the toolbar by going to View -> Command Palette.
- Type in
"Device Simulator Express: Getting Started"in the command palette (Ctrl + Shift + P / Cmd + Shift + P to open the command palette). - Choose the the device you want to play with from the dropdown.
- Read, copy and learn some of the things you can do with the simulator!
- Type in
"Device Simulator Express: New File"in the command palette (Ctrl + Shift + P / Cmd + Shift + P to open the command palette). - Select the device you want to use.
- Name and save your file somewhere, and we’re good to go!
- Start with some examples: you can find examples files and tutorials inside the comments at the top of the file.
- Open the folder or your .py file in Visual Studio Code.
- Run
Device Simulator Express: Open Simulatorfrom the command palette or icon in the editor toolbar. - Select the device you want to use.
- Run
Run Simulatorfrom the command palette or use thePlaybutton on the simulator webview.
Before deploying the Python code to your CPX device, you need to format your device by following these tutorials:
-
For the CPX:
- Download the firmware with the .uf2 file (link: https://learn.adafruit.com/adafruit-circuit-playground-express/circuitpython-quickstart).
- Download the lastest versions of the cpx libraries (link: https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries).
-
For the micro:bit:
- Download the firmware with the .hex file (link: https://microbit.org/get-started/user-guide/firmware/).
-
For the CLUE:
- Download the latest versions of the cpx libraries and follow the instructions here (link:https://learn.adafruit.com/adafruit-clue/circuitpython).
- Plug in your device (make sure it’s formatted properly already).
- Run the command
"Device Simulator Express: Deploy to Device".
- Plug in your device (make sure it’s formatted properly already).
- Run the command
"Device Simulator Express: Open Serial Monitor". - Select your baud rate for the serial port.
- The
print()statements in your code will show in the output console.
- Add breakpoints in your code
- Press F5 to enter the debugging mode, and you can start debugging line by line!
Device Simulator Express provides several commands in the Command Palette (F1 or Ctrl + Shift + P / Cmd + Shift + P for Mac OS) for working with *.py files:
Device Simulator Express: Getting Started: Opens a page in VS Code that helps users get started with the extension. Here, users can browse through code that they can use to play with the simulators.Device Simulator Express: Run Simulator: Runs Python code on the simulator.Device Simulator Express: New File: Opens an unsaved .py file with template code, also opens the simulator for the selected device.Device Simulator Express: Open Simulator: Opens the simulator in the simulator window for the selected device






