i2c_control.py

# Ce travail est publié sous licence MIT.
# Copyright (c) 2013-2023 OpenMV LLC. Tous droits réservés.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# Exemple I2C.
from pyb import I2C


i2c = I2C(2, I2C.MASTER)
if 0x29 not in i2c.scan():
    raise RuntimeError("Failed to detect ToF")

# Lire l'identifiant de modèle du ToF.
mid = i2c.mem_read(1, 0x29, 0x010f, addr_size=16)
# Devrait afficher 0xEA
print(f"ToF Model ID: 0x{mid[0]:02X}")

results matching ""

    No results matching ""