FireBeetle 2 ESP32 C6开发板 __ADC模块测试
[复制链接]
这次测试一下ESP32 的 ADC
1 . MCU使用3.3V供电
2. 使用电位器提供信号
3.测试代码
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4095)
analogReadResolution(12);
}
void loop() {
// read the analog / millivolts value for pin 2:
int analogValue = analogRead(2);
int analogVolts = analogReadMilliVolts(2);
// print out the values you read:
Serial.printf("ADC analog value = %d\n",analogValue);
Serial.printf("ADC millivolts value = %d\n",analogVolts);
delay(100); // delay in between reads for clear read from serial
}
4.测试情况
电压值
|
AD值
|
3.3
|
3344
|
2.38
|
2382
|
2.03
|
2033
|
1.70
|
1701
|
1.00
|
1002
|
这个值很奇怪 3,3V按道理应该是4095,为啥是3344,好像经过了变换,有兄台知道咋会事吗
|