Example: 50-OpenMV-Boards/53-N6-Boards/50-Board-Control/adc.py

# 本作品采用MIT许可证授权。
# Copyright (c) 2013-2026 OpenMV LLC. All rights reserved.
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# ADC读取示例。
#
# 此示例展示了如何使用ADC读取模拟引脚。
# On the OpenMV N6 the analog input on the P6 connector pin is routed
# through a level translator to a separate ADC channel. Use the "P6_ADC"
# alias to access it. "BAT_ADC" reads the battery voltage.

import time
from machine import ADC

adc = ADC("P6_ADC")  # Use "BAT_ADC" to read the battery voltage instead.

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

results matching ""

    No results matching ""