Skip to content

Using the repl

Gijs Mos edited this page Nov 17, 2019 · 4 revisions

ToDo - elaborate including the web repl

One method is to connect a putty serial console screen to the board's USB port at 115200 baud (8 bit, 1 stop bit, no flow control). Press reset and the repl should appear.

You can also use rshell. The command to enter REPL is: repl. No need to press reset in this case.

The REPL prompt looks like >>> (or ... when in continuation mode). When in the REPL type:

   print('Hello <your name here>!')

and your first Python program will run and welcome you!

When in the REPL the following control commands are available (the ^ is used for the control key):

  • ^d - Soft reset. Then starts up your boot.py and main.py files, or puts you in back into a clean REPL when no such file(s) exist.
  • ^c - Abort a runnng python program.
  • ^e - Go into paste mode. Disables the built in formatter. Use to paste pre-formatted code.
  • ^d - Leave paste mode. When not in paste mode this is a re-boot, so take care.
  • ^x - Leave the REPL and get you back into MicroPython.
  • up/down arrow - navigate the statement history. May not work if you run under Windows. This is a Windows bug.
  • TAB - autocomplete. Micropython tries to finish the command based on context. It stops auto completion when it hist an ambiguity.
Clone this wiki locally