Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
REPL mode on LEGO Education SPIKE Prime hub
MicroPython v1.9.4-1146-gca9944357 on 2019-10-03; LEGO Technic Large Hub with STM32F413xx
Type "help()" for more information.
>>> help()
Welcome to MicroPython!
For online help please visit http://micropython.org/help/.
Quick overview of commands for the board:
hub.info() -- print some general information
hub.status() -- print sensor data
Control commands:
CTRL-A -- on a blank line, enter raw REPL mode
CTRL-B -- on a blank line, enter normal REPL mode
CTRL-C -- interrupt a running program
CTRL-D -- on a blank line, do a soft reset of the board
CTRL-E -- on a blank line, enter paste mode
For further help on a specific object, type help(obj)
For a list of available modules, type help('modules')
>>> help('modules')
__main__ heapq struct umachine
_onewire hub sys uos
array io time urandom
binascii json ubinascii ure
builtins machine ucollections uselect
cmath math uctypes ustruct
collections micropython uerrno utime
errno os uhashlib utimeq
firmware random uheapq uzlib
gc re uio zlib
hashlib select ujson
Plus any modules on the filesystem
>>> import hub
>>> hub.status()
{'gyroscope': (0, 2, -3), 'position': (177, 90, 0), 'accelerometer': (-1019, 15, -36), 'port': {'C': [], 'D': [0, 0, -107, 0], 'B': [0, 0, -160, 0], 'E': [], 'A': [], 'F': [0, 0, 379]}, 'display': '00000:00000:00000:00000:00000'}
>>> import os
>>> os.listdir()
['local_name.txt', 'bt-lk1.dat', 'bt-lk2.dat', 'boot.py', 'commands', 'event_loop', 'hub_runtime.mpy', 'main.py', 'programrunner', 'projects', 'protocol', 'runtime', 'sounds', 'system', 'ui', 'util', 'version.py', 'runtime.log']
>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment