MAE 3185 - Introduction to Mechatronics

Logo

View the Project on GitHub Abhiricky1992/UTA-MAE3185-Notes

hardware_adc Library Functions

To use this library, add following to the C/C++ file,

#include <hardware/adc.h>

and following to the CMakeLists.txt file.

target_link_libraries(projectName pico_stdlib hardware_gpio hardware_adc)

Following are some of the most commonly used functions for configuring the ADC.

adc_init()

Initialize the ADC peripheral on the μC.

adc_gpio_init(uint8_t pinNo)

This function initializes a GPIO to work with an ADC input.

adc_select_input(uint8_t adcIn)

This function prepares an ADC input for reading.

uint16_t adc_read()

This function makes ADC to read voltage from the input selected using adc_select_input(adcIn) function.

Code Examples

Back

Working of an ADc