![](/media/cache/group/ST_logo_2020_blue_V_cmyk.jpg.50x50_q85.jpg)
ADC internal channels read example.
Dependencies: mbed
main.cpp
- Committer:
- arostm
- Date:
- 2017-06-07
- Revision:
- 5:bc100134b571
- Parent:
- 4:e784c25594d7
- Child:
- 6:3e184b0bcc33
File content as of revision 5:bc100134b571:
#include "mbed.h" /* This basic example just shows how to read the ADC internal channels raw values. Please look in the corresponding device reference manual for a complete description of how to make a temperature sensor, VBat or Vref measurement. */ AnalogIn adc_temp(ADC_TEMP); AnalogIn adc_vref(ADC_VREF); AnalogIn adc_vbat(ADC_VBAT); // Warning: Not available on all devices DigitalOut led(LED1); int main() { printf("\nSTM32 ADC internal channels reading example\n"); while(1) { printf("ADC Temp = %f\n", adc_temp.read()); printf("ADC VRef = %f\n", adc_vref.read()); printf("ADC VBat = %f\n", adc_vbat.read()); printf("\033[3A"); led = !led; wait(1.0); } }