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.
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
-
Clone the repository
-
Install the dependencies
npm ci
-
Package and install the extension
npm run package code --install-extension robotinventor-1.0.0.vsix
After installing the extension open the RI5DEV device browser:
and click on "Add LEGO Hub". The Hub must be connected via USB. Select the device:
The extension will retrieve the storage status of the Hub and will show all available programs.
You can then right click on any slot and perform any of the following operations:
- Execute a program
- Remove a program
- Move a program from one slot to another
- 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.
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):
LEGO and Mindstorms are trademarks of the LEGO Group.
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.