ESP32 Arduino 读取ADC速度问题?

wukong
Posts: 1
Joined: Fri Oct 04, 2019 1:51 pm

ESP32 Arduino 读取ADC速度问题?

Postby wukong » Fri Oct 04, 2019 2:08 pm

void setup() {
Serial.begin(115200);
}

void loop() {

unsigned long begt = 0, begt2 = 0, runt = 0;
int v1 = 0;

begt = micros();//记录开始微秒数

for (unsigned long i = 0; i < 1000000; i++)
{
v1 = analogRead(32);
}

begt2 = micros();//记录结束微秒数
runt = begt2 - begt; //计算用时

Serial.println(String(runt));
}



//输出结果大约 10,000,000
//即读取模拟值 {v1 = analogRead(32);} 的时间约为10微秒
//我现在的问题就是想加快这个速度,10微秒太慢了,要如何改进呢?

ESP_Gargamel
Posts: 41
Joined: Wed Nov 14, 2018 8:45 am

Re: ESP32 Arduino 读取ADC速度问题?

Postby ESP_Gargamel » Fri Nov 08, 2019 3:02 am

Arduino 问题,建议到 Arduino 板块进行提问。

Who is online

Users browsing this forum: No registered users and 3 guests