ESP8266 ADC
来自Jack's Lab
(版本间的差异)
(→Example) |
(→Example) |
||
第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