Back to SBCs/MCUs

MicroPython Notes

Terminal commands for MicroPython.

---------------------------------------------------

List available serial devices:

input

ls /dev/tty.*

example output

/dev/tty.BLTH                     /dev/tty.TiffanysBeatsStudio
/dev/tty.Bluetooth-Incoming-Port  /dev/tty.usbmodem3564365235362
---------------------------------------------------

Getting a MicroPython REPL prompt, open a terminal and run:

input

screen /dev/tty.usbmodem*
---------------------------------------------------

Open a serial connection at 115200 baud to your connected device:

input

screen /dev/tty.usbmodem3564365235362 115200
---------------------------------------------------

Soft reset:

input Ctrl+D

example output

PYB: sync filesystems
PYB: soft reboot
To run all tests: test_all()
Individual tests are: test_features, test_mandel
 argument should be a connection, eg "X", or an LCD160CR object
---------------------------------------------------

Exit:

input Ctrl+A then Ctrl+\

---------------------------------------------------

List files and directories in the root of the filesystem in MicroPython device:

input

import os
os.listdir()

example output

['main.py', 'boot.py', '.Spotlight-V100', '.fseventsd']
---------------------------------------------------

Directing the MicroPython output to the display:

input

import lcd160cr
import pyb
lcd=lcd160cr.LCD160CR('X')
lcd.erase()
uart = pyb.UART('XA', 115200)
pyb.repl_uart(uart)


Back to SBCs/MCUs

© 2025. This work by Isaiah Keating is openly licensed via CC BY-SA 4.0