ルーチン説明-02-read_adc ADCを読み込む

# 读取ADC例子
#
# 这个例子展示了如何使用ADC读取模拟引脚

import time
from pyb import ADC

adc = ADC("P6") # 必须是“P6”。

while(True):
    # ADC 12-bits 精度,4096个值
    print("ADC = %fv" % ((adc.read() * 3.3) / 4095))
    time.sleep_ms(100)

pyb モジュールは OpenMV RT では使用できません。使用できるのは次のマシン モジュールのみです。

# 读取ADC例子
#
# 这个例子展示了如何使用ADC读取模拟引脚

import time
from machine import ADC

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

while True:
    # ADC 16-bits 精度,65536个值
    print("ADC = %fv" % ((adc.read_u16() * 3.3) / 65535))
    time.sleep_ms(100)

pyb モジュール adc.read() 関数ドキュメント: Xingtong Technology OpenMV 公式中国語ドキュメント関数説明:

results matching ""

    No results matching ""