ESP8266 ADC

来自Jack's Lab
2018年10月28日 (日) 17:03Comcat (讨论 | 贡献)的版本

(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
跳转到: 导航, 搜索

1 Overview

  • 10 bit sigmal delta ADC
  • Internal reference voltage is 1.0 V



2 Example

On Noduino Falcon board:

#include "noduino.h"

/*
 * A0 --> 220K ---> 100K --> GND
 *              |
 *              |
 *           esp_adc
 */
void setup()
{
        serial_begin(115200);
        wifi_set_opmode(NULL_MODE);
}

void loop() {

  int ad = analogRead(A0);

  serial_printf("ad = %d\r\n", ad);

  float V = (ad / 1024.0) * (220 + 100)/100;
  serial_printf("V*1000 = %d\r\n", (int)(V*1000));

  delay(5000);
}


Connect A0 to GND, Output:

ad = 0
V*1000 = 0
ad = 0
V*1000 = 0


Connect A0 to 3.3V, Output:

ad = 1024
V*1000 = 3200
ad = 1024
V*1000 = 3200















个人工具
名字空间

变换
操作
导航
工具箱