LEGO SPIKE Prime / MINDSTORMS Robot Inventor ExtensionThis extension helps you connect to the SPIKE Prime or MINDSTORMS Robot Inventor brick and perform various operations on it. FeaturesShows the connections status right in the status bar
You can upload two types of programs with this extension: Python (standard)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. Python (advanced)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. PreprocessorTo 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 fileDuring 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
Known Issues
CreditsThanks to sanjayseshan/spikeprime-tools and bricklife for figuring out currently available JSON RPC that the brick supports. DisclaimerThis 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 1.0.6.34 with runtime version 2.1.4.13 LEGO and MINDSTORMS are registered trademarks of the LEGO Group. SPIKE is trademark of LEGO Group. |