MicroPython code to list available I2C/SPI and default GPIO assigned
Simple MicroPython code to list available I2C/SPI and default GPIO assigned. Tested on Raspberry Pi Pico 2 (RP2350) running micropython v1.24.0-preview.201. mpy_list_i2c_spi.py """ MicroPython to list available I2C/SPI and default GPIO assigned """ import sys, os import machine print("====================================") print(sys.implementation[0], os.uname()[3], "\nrun on", os.uname()[4]) print("====================================") print("List available I2C and SPI\n") print("Available I2C and default GPIO assigned:") n = 0 while True: try: i2c = machine.I2C(n) print(i2c) n = n+1 except ValueError as exc: print("ValueError:", exc) break print() print("Available SPI and default GPIO assigned:") n = 0 while True: try: spi = machine.SPI(n) print(spi) n = n+1 except ValueError as exc: pr