adc.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2026 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# ADC读取示例。
#
# 此示例展示了如何使用ADC读取模拟引脚。
# P8和P9是OpenMV AE3上仅有的支持ADC的I/O引脚。
# 这些引脚耐压1.8V(不像其他I/O引脚是3.3V)。

import time
from machine import ADC

adc = ADC("P8")  # 在OpenMV AE3上必须为“P8”或“P9”。

while True:
    # ADC具有16位分辨率,可输出65536个数值。
    print("ADC = %fv" % ((adc.read_u16() * 1.8) / 65535))
    time.sleep_ms(100)

results matching ""

    No results matching ""