Example: 50-Arduino-Boards/Portenta-H7/50-Board-Control/adc_read_ext_channel.py

# 本作品采用MIT许可证授权。
# 版权所有 (c) 2013-2023 OpenMV LLC。保留所有权利。
# https://github.com/openmv/openmv/blob/master/LICENSE
#
# ADC读取示例。
#
# 此示例展示了如何使用ADC读取模拟引脚。

import time
from pyb import ADC

adc = ADC("P6")  # Must always be "P6".

while True:
    # ADC具有12位分辨率,可读取4096个值。
    print("ADC = %fv" % ((adc.read() * 3.3) / 4095))
    time.sleep_ms(100)

results matching ""

    No results matching ""