CircuitPython to scan I2C devices address

To scan I2C devices address using CircuitPython:

import time
import board

print("I2C SDA:", board.SDA)
print("I2C SCL:", board.SCL)
i2c = board.I2C()

while not i2c.try_lock():
    pass

try:
    devices = i2c.scan()
    print("I2C addresses:",
          [hex(address) for address in devices])

finally:
    i2c.unlock()


Test on Seeed Studio XIAO nRF52840 Sense with XIAO Expansion board, running CircuitPython 7.3.2.


Comments

Popular posts from this blog

480x320 TFT/ILI9488 SPI wih EP32C3 (arduino-esp32) using Arduino_GFX Library

Drive 320x240 ILI9341 SPI TFT using ESP32-S3 (NodeMCU ESP-S3-12K-Kit) using TFT_eSPI library, in Arduino Framework.