Library adc
To use this library in your code:
Analog-to-Digital Conversion.
This library provides ways to read analogue voltage values from GPIO pins that support it.
On most ESP32 variants, there are two ADCs. ADC1 should be preferred as ADC2 has lots of restrictions. It can't be used when WiFi is active, and some of the pins are strapping pins.
By default, ADC2 is disabled, and users need to pass in a flag to allow its use.
Examples
import gpio.adc show Adc
main:
adc := Adc 34
print adc.get
adc.close
Pins
ESP32
ADC1: Pins 32-39
ADC2: Pins 0, 2, 4, 12-15, 25-27
ESP32C3
ADC1: Pins 0-4
Pin 5 is an ADC pin of channel 2. However, the controller of ADC channel 2 may enter an inoperative state and was therefore disabled by Espressif. An errata was published.
ESP32C6
ADC1: Pins 0-6
No ADC2.
ESP32P4
ADC1: Pins 16-23, 49-54
ESP32S2
ADC1: Pins 1-10
ADC2: Pins 11-20
ESP32S3
ADC1: Pins 1-10
ADC2: Pins 11-20
Classes
ADC unit for reading the voltage on GPIO Pins.