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

my dev.tools - FNIRSI 2C23T 3-in-1 Dual Channel Oscilloscope/Multimeter/Signal Generator