Added ADC API doc + simple example (#6301)

* Added ADC API doc + simple example

* Added attenuation input voltage range + conf.py added tabs extension

* Update requirements.txt

* Update adc.rst
This commit is contained in:
P-R-O-C-H-Y
2022-02-23 14:45:19 +01:00
committed by GitHub
parent b5f3d6c836
commit a135169176
4 changed files with 230 additions and 1 deletions

View File

@ -0,0 +1,19 @@
void setup() {
// initialize serial communication at 115200 bits per second:
Serial.begin(115200);
//set the resolution to 12 bits (0-4096)
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
}