In case your having problems with I2C connections

Simple I2C scanner

from pyb import I2C
import time

i2c = I2C(2, I2C.MASTER, baudrate=100000)  # Use 100kHz for better compatibility

print("\r\nScanning I2C 2 bus, .")
time.sleep(1)

devices = i2c.scan()
print(devices)
if not devices:
    print("❌ No I2C devices found. Check wiring, power, and pullups.\r\n")
else:
    print("✅ I2C devices found:")
    for device in devices:
        print(" - Address: 0x{:02X}".format(device))

Recommend to use the machine module in the future.

Importing I2C from machine never worked

This works on the RT1062 for example:

import machine, time

bus = machine.I2C(2)

print(bus.scan())

your code worked on cam h7 plus, output in decimal