Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
List all the pins in the board module, all aliases on the same line, sorted by name
import microcontroller,board
allpins = []
for pin in dir(
if isinstance(getattr(, pin), microcontroller.Pin):
pins = []
for alias in dir(board):
if getattr(board, alias) is getattr(, pin):
if len(pins)>0:
allpins.append(" ".join(pins))
for pins in allpins: print(pins)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment