/robotinventor-vscode

A Microsoft Visual Studio Code extension to program LEGO® MINDSTORMS® Robot Inventor in MicroPython

Primary LanguageTypeScriptMIT LicenseMIT

VScode extension for the Robot inventor set

codecov CI

This is a Microsoft Visual Studio Code extension to program the LEGO® MINDSTORMS® Robot Inventor set in MicroPython.

  • It only works on macOS and Linux, at the moment. Windows is not supported.
  • It only works with Hubs connected via USB.

How to install

Before installing the extension, please read the disclaimer at the end of this page.

Prerequisites

In order to compile and install the extension you need npm v12.x. If you use nvm simply nvm use inside the repository (make sure the npm version specified in .nvmrc is installed). Also, you need the command line code command installed.

Install the extension

  1. Clone the repository

  2. Install the dependencies

    npm ci
    
  3. Package and install the extension

    npm run package
    code --install-extension robotinventor-1.0.0.vsix
    

How to use the extension

After installing the extension open the RI5DEV device browser:

Connect Hub

and click on "Add LEGO Hub". The Hub must be connected via USB. Select the device:

Select device

The extension will retrieve the storage status of the Hub and will show all available programs.

Storage status

You can then right click on any slot and perform any of the following operations:

  1. Execute a program
  2. Remove a program
  3. Move a program from one slot to another
  4. Upload a program. You need to have the corresponding micropython file open.

Also, by right-clicking on the Hub you can select the command to stop the execution of a program.

Commands

Useful links and external references

Since there is no official documentation for the API, the implementation is based on what I could discover empirically. I also obtained information from the following repositories, based on the LEGO® Education SPIKE™️ Prime Set:

I based the implementation on the work of David Lechner (for EV3):

ev3dev/vscode-ev3dev-browser

LEGO and Mindstorms are trademarks of the LEGO Group.

Disclaimer

The material embodied in this software is provided to you "as-is" and without warranty of any kind, express, implied or otherwise, including without limitation, any warranty of fitness for a particular purpose. In no event shall the author of this software be liable for any direct, special, incidental, indirect or consequential damages of any kind arising out of or in connection with the possession, use or performance of this software.