#include "esp_adc/adc_oneshot.h"
Go to the source code of this file.
◆ TARGET_ATTEN
| #define TARGET_ATTEN ADC_ATTEN_DB_12 |
◆ TARGET_UNIT
| #define TARGET_UNIT ADC_UNIT_1 |
◆ TARGET_WIDTH
| #define TARGET_WIDTH ADC_BITWIDTH_DEFAULT |
◆ TIME_BETWEEN_SHOT_MS
| #define TIME_BETWEEN_SHOT_MS 3 |
◆ adc_sensor_init()
Initialize an ADC sensor for one-shot readings.
Configures the ADC channel, attenuation, and calibration. Call once before using adc_sensor_read().
- Parameters
-
| sensor | Pointer to adc_sensor to initialize (channel and num_samples must be set) |
- Returns
- ESP_OK on success, error code otherwise
◆ adc_sensor_read()
Read voltage from the ADC sensor.
Performs a one-shot conversion and updates sensor->voltage_mv. Uses the configured number of samples and calibration.
- Parameters
-
- Returns
- ESP_OK on success, error code otherwise