For most MicroPython boards you can access the MicroPython REPL (read-evaluate-print loop) over their USB serial connections.  Be sure to first follow any instructions and install drivers specific to your board to ensure you can access the USB serial connection:

Note the WiPy board REPL is only accessible over its wireless interface with telnet. Follow the WiPy instructions for connecting to the telnet REPL instead of the steps below for accessing with a serial terminal.

Determine the name of the serial port for your board.  It's easiest to look at the serial ports with the board disconnected (on Windows check Device Manager under the Ports (COM/LPT) node, or on Mac OSX/Linux run the ls /dev/tty.* command in a terminal), then connect the board and look at the serial ports again to find the newly added port.

See the videos and and notes below for details on tools to access the REPL from different platforms.

On Windows you'll want to use a tool like PuTTY to connect to the serial port.  Download and run PuTTY, then configure it to use a serial connection to the board's COM port at 115200 baud similar to as shown below:

On Linux or Mac OSX the screen command can be used to connect to the serial port.  Run the following command to connect at 115200 baud:

screen /dev/tty.board_name 115200

Where /dev/tty.board_name is the name of the board's serial port.

When you're done using screen most versions of it allow you to exit by pressing Ctrl-a then k then y or presing Ctrl-a then typing :quit and pressing enter.

After you're connected to the serial REPL try pressing enter to confirm you see the >>> prompt.  You can also type help() and press enter on most boards to see basic usage information.

If you can't get a >>> prompt to appear try pressing Ctrl-c a couple times to interrupt any running program on the board.

That's all there is to connecting to the board's serial REPL, you're ready to start typing in and running MicroPython code!

This guide was first published on Aug 16, 2016. It was last updated on Aug 16, 2016.

This page (Serial REPL) was last updated on Aug 14, 2016.

Text editor powered by tinymce.