mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
14 lines
281 B
Python
14 lines
281 B
Python
# ADC Read Example.
|
|
#
|
|
# This example shows how to use the ADC to read an analog pin.
|
|
|
|
import time
|
|
from pyb import ADC
|
|
|
|
adc = ADC("A0")
|
|
|
|
while True:
|
|
# The ADC has 12-bits of resolution for 4096 values.
|
|
print("ADC = %fv" % ((adc.read() * 3.3) / 4095))
|
|
time.sleep_ms(100)
|