Untitled
unknown
plain_text
a year ago
558 B
1
Indexable
import board import busio # Initialize I2C bus i2c = busio.I2C(board.SCL, board.SDA) # Scan for I2C devices and print their addresses device_addresses = [] for device_address in range(128): try: i2c.writeto(device_address, b'') device_addresses.append(hex(device_address)) except OSError: # Error means no device at that address pass if device_addresses: print("I2C devices found at addresses:") for address in device_addresses: print(address) else: print("No I2C devices found.")
Editor is loading...
Leave a Comment