https://github.com/peterstaev/lego-spikeprime-mindstorms-vscode
Helps you connect and work with Lego's SPIKE Prime/MINDSTORMS Robot Inventor hubs
https://github.com/peterstaev/lego-spikeprime-mindstorms-vscode
lego mindstorms prime spike
Last synced: 8 months ago
JSON representation
Helps you connect and work with Lego's SPIKE Prime/MINDSTORMS Robot Inventor hubs
- Host: GitHub
- URL: https://github.com/peterstaev/lego-spikeprime-mindstorms-vscode
- Owner: PeterStaev
- License: apache-2.0
- Created: 2020-12-28T21:06:57.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-01-27T17:02:41.000Z (over 2 years ago)
- Last Synced: 2025-03-28T13:38:25.645Z (about 1 year ago)
- Topics: lego, mindstorms, prime, spike
- Language: TypeScript
- Homepage:
- Size: 930 KB
- Stars: 72
- Watchers: 6
- Forks: 23
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# LEGO SPIKE Prime / MINDSTORMS Robot Inventor Extension
This extension helps you connect to the SPIKE Prime or MINDSTORMS Robot Inventor brick and perform various operations on it.
> [!IMPORTANT]
> Starting with version 2.x of the extension it will work ONLY with HubOS3. If you are running on the legacy HubOS2, please use the 1.x version and disable auto-updates for the extension.
## Features
Shows the connections status right in the status bar

\
Clicking on the status will either connect or disconnect (if already connected).
\
Once connected you can start a running program by choosing its slot.

Also once you are connected in any python file you can execute commands conveniently by using the appropriate button at the top right of the editor file:

### Preprocessor
To support multi files before the compilation (or upload if not compiled) imported files will be inserted in the current python script.
At the moment only
```python
from file_name import *
```
is supported. Files not found are skipped (in the hope they exist on the hub). Nevertheless an error will inform you.
> [!NOTE]
> This is not supported for web extension usage.
### Custom Preprocessor
The plugin has a settings where you can specify an external program/script that should be executed before uploading the program
to the hub. This will receive the contents of the file as stdin. It should output the resulting file contents to stdout and exit the process with `0`.
> [!NOTE]
> This will be executed AFTER the builtin preprocessor for combining the files and right before compiling and uploading the program to the hub!
> [!NOTE]
> This is not supported for web extension usage.
### Compilation
The extension supports compiling Python files to binary (MPY) before uploading. This is controlled by a setting:

## Automatic upload/start of a python file
During active development you will be uploading a program over and over again so going through all the prompts for type and slot is not very convenient. You can skip those prompts and automatically start the program after uploading by adding a specific comment line as first in your program.
```python
# LEGO slot:<0-19> [autostart]
```
For example, if I want the program to be uploaded to slot 5 and autostart it once the upload is finished the comment should be the following
```python
# LEGO slot:5 autostart
```
## Credits
Thanks to LEGO Group to publish [extensive docs](https://lego.github.io/spike-prime-docs/index.html) on how to work with the HubOS protocol.
## Disclaimer
_LEGO and MINDSTORMS are registered trademarks of the LEGO Group. SPIKE is trademark of LEGO Group._