Micropython-repl
What is REPL?
REPL stand for Read Eval Print Loop, it is the way used by MicroPython to offers an interactive interface to the MicroPython.
REPL is like an Command Interpreter and is great way to test some code snippet or function calls without the need of writing and saving a script on the microcontroller.
As shown in the Thonny IDE introduction, REPL is the first interface to be tested with a MicroPython Microcontroler.
The REPL start with the ">>>" prompt and it ends with a carriage return.
It supports multi-line scripting is allowed. Great for interactive coding of loops and functions.
Indeed, connecting to the USB-Serial interface (so REPL) will displays the print() statement issued by the running script.
It is a great way to figure out what happening in the script without halting it!Tools supporting REPL
As REPL session is mainly established via an UART or USB-Serial THEN any terminal emulation software supporting UART will do the work.
Among other things
| Tool | Interface | Remark |
|---|---|---|
| Thonny IDE | Graphical | See Pymate tutorial here.
Code Editor, Repl, File Transfer, Execute. |
| MPRemote | Command line | Official MicroPython tool.Repl, File Transfer, Execute. |
| Putty | Graphical | Terminal only. |
| RShell | Command line | Remote Shell. Repl, File Transfer, Execute. |
After Thonny, MPRemote is probably the most useful tools when doing MicroPython development.
Capture here below shows the MPRemote tool in action (REPL session):
REPL Escape Sequence
Some escape sequence can be used inside REPL.
| Sequence | Description |
|---|---|
| Ctrl C | Keyboard Interrupt. Stop the script currently running. |
| Ctrl D | Soft Reboot of MicroPython virtual machine.
That doesn't reinitialize the UART connexion. |
| Ctrl A | Move cursor at the begin of line |
| Ctrl E | Move cursor at the end of line |
| Ctrl E | On empty line: start the multi-lines PASTE mode.
The >>> prompt is replace with === |
| Ctrl D | On empty line: finish PASTE mode and parse the
bloc of text. |
| Ctrl C | On empty line: cancel the PASTE mode. |
| Ctrl A | On empty line: start the RAW REPL.
Nothing echoed on the terminal. |
| Ctrl B | On empty line: goes to normal REPL mode. |
PymateIO all right reserved © 2026 - Written by MCHobby for PymateIO
