Command prompt

Python code and building instructions for the LEGO MINDSTORMS Robot Inventor Main Models (51515).

Command prompt
Image credit: LEGO

Control Gelo with the interactive command prompt

Using the command prompt

Python has an interactive command prompt. This is also sometimes called the REPL (Read Evaluate Print Loop). It can be used to run Python code as you type it in.

Save the program below as in Pybricks Code. And make sure you have the saved there too.

Then connect to Gelo and run the program. In the terminal window in Pybricks Code, you will see a prompt like this:


Type in a command like this and press enter:

>>> gelo.walk()


  • To save some typing, after typing gelo., you can press the tab key to provide a list of available methods. Then type the first few letters and press tab again to complete the name.
  • To cancel a running command, you can press ctrl+c.


from gelo import Gelo

gelo = Gelo()

# Normally, we don't call methods with
# double-underscores directly, but this
# is an exceptional case!

# A KeyboardInterrupt will stop the
# program and start the interactive
# prompt. You can also trigger this
# in any running program by pressing
# CTRL+C in the terminal.
raise KeyboardInterrupt

This project was submitted by The Pybricks Team.