from machine import Pin, ADC
from time import sleep_ms
adc = ADC(Pin(5))
print(dir(ADC))
adc.width(ADC.WIDTH_12BIT) # 设置 ADC 的位数为 0-1023(2^10-1)
while 1:
print(adc.read())
sleep_ms(500)
Loading
esp32-s3-devkitc-1
esp32-s3-devkitc-1
from machine import Pin, ADC
from time import sleep_ms
adc = ADC(Pin(5))
print(dir(ADC))
adc.width(ADC.WIDTH_12BIT) # 设置 ADC 的位数为 0-1023(2^10-1)
while 1:
print(adc.read())
sleep_ms(500)