ESP8266 ADC

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(Example)
(Example)
 
(未显示1个用户的1个中间版本)
第8行: 第8行:
 
== Example ==
 
== Example ==
  
On [[Noduino Falcon]] board:
+
On [https://github.com/icamgo/Noduino-Falcon-Board Noduino Falcon] board:
  
 
<source lang=cpp>
 
<source lang=cpp>
第39行: 第39行:
  
  
Output:
+
Connect A0 to GND, Output:
  
 
<source lang=bash>
 
<source lang=bash>
第46行: 第46行:
 
ad = 0
 
ad = 0
 
V*1000 = 0
 
V*1000 = 0
 +
</source>
 +
 +
 +
Connect A0 to 3.3V, Output:
 +
 +
<source lang=bash>
 
ad = 1024
 
ad = 1024
 
V*1000 = 3200
 
V*1000 = 3200
 
ad = 1024
 
ad = 1024
 +
V*1000 = 3200
 
</source>
 
</source>
  

2018年10月28日 (日) 17:03的最后版本

[编辑] 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















个人工具
名字空间

变换
操作
导航
工具箱