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.
Shows the connections status right in the status bar
You can upload two types of programs with this extension:
This is more or less the same as a python project, created with the Mindstorms or SPIKE prime apps. But allows you to use your favorite code editor and its extensions instead of the built in one.
This gives you access to an async code execution and event notifications that are provided by built in event loop that runs on the brick. The event loop is used to run Scratch programs and I haven't found any other way to access it from standard python type programs.
The advanced programs mus follow a specific template in order for them to execute correctly:
You can check what advanced functions found so far here.
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
is supported. Files not found are skipped (in the hope they exist on the hub). Nevertheless an error will inform you.
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.
For example, if I want the program to be uploaded as an advanced python program to slot 5 and autostart it once the upload is finished the comment should be the following
This extension uses unofficial and undocumented APIs. They can change without notice. Functions tested on a Mac connecting to a MINDSTORMS Robot Inventor Hub FW Version 126.96.36.199 with runtime version 188.8.131.52
LEGO and MINDSTORMS are registered trademarks of the LEGO Group. SPIKE is trademark of LEGO Group.