# i2c_scan.py
# 24.11.2025
# www.g-heinrichs.de

from machine import I2C, Pin

i2c = I2C(1, scl = Pin(22), sda = Pin(21), freq = 100_000) 

print('I2C-Bus scannen...')
devices = i2c.scan()

if len(devices) == 0:
    print('Keine I2C-Geraete gefunden!')
else:
    print('I2C-Geraete gefunden:',len(devices))
    for device in devices:
        addr = device
        print('Dez-Adr: ', addr)
        print('Hex-Adr: ', hex(addr))


