Example: 50-Arduino-Boards/Nano-RP2040/50-Board-Control/i2c_scanner.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# I2C 扫描示例
#
# NANO RP2040 在 I2C0 总线上的 7 位地址:
#
# ATECC608A  0x60
# LSM6DSOX   0x6A

from machine import Pin
from machine import I2C

i2c_list = [None, None]
i2c_list[0] = I2C(0, scl=Pin(13), sda=Pin(12), freq=100_000)
i2c_list[1] = I2C(1, scl=Pin(7), sda=Pin(6), freq=100_000)

for bus in range(0, 2):
    print("\nScanning bus %d..." % (bus))
    for addr in i2c_list[bus].scan():
        print("Found device at address %d:0x%x" % (bus, addr))

results matching ""

    No results matching ""