MantisIDE

Find I2C devices

Guide by MantisIDE Team · Fri Nov 27 2026 · 0 points · 0 comments

List the addresses of everything on the I2C bus.

A starter program from the MantisIDE Full IDE (Tools › Examples). Press Open in Full IDE to run it on your board, change it, and save it as your own.

# List the addresses of everything on the I2C bus.
from machine import Pin, I2C

i2c = I2C(0, scl=Pin(22), sda=Pin(21))  # Pico: I2C(0, scl=Pin(5), sda=Pin(4))
found = i2c.scan()
if found:
    print("Found:", [hex(a) for a in found])
else:
    print("Nothing found. Check wiring and pull-up resistors.")
Loading post…

Dialog