CircuitPython I2C Scanner, run on ESP32-S3-Zero
CircuitPython I2C Scanner, run on WaveShare ESP32-S3-Zero/CircuitPython 9.0.0-beta.0.
cpy_S3-Zero_I2C_Scanner.py"""
CircuitPython run on ESP32-S3-Zero
scan I2C devices' address
"""
import sys, os
import board
import busio
SCL = board.IO1
SDA = board.IO2
i2c = busio.I2C(SCL, SDA)
print("=================================================")
info = sys.implementation[0] + ' ' + os.uname()[3] + '\n' + \
'run on ' + os.uname()[4]
print(info)
print("I2C Scanner")
print("=================================================")
# wait untill i2c locked
while not i2c.try_lock():
pass
print([hex(x) for x in i2c.scan()])
i2c.unlock()
Comments
Post a Comment