Emery Premeaux / Mbed 2 deprecated Examples

Dependencies:   mbed SDFileSystem

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ADC_Internal.cpp Source File

ADC_Internal.cpp

00001 #ifdef COMPILE_ADC_Internal  
00002 
00003 /*
00004    This basic example just shows how to read the ADC internal channels raw values.
00005    Please look in the corresponding device reference manual for a complete
00006    description of how to make a temperature sensor, VBat or Vref measurement.
00007 */
00008 
00009 AnalogIn adc_temp(ADC_TEMP);
00010 AnalogIn adc_vref(ADC_VREF);
00011 AnalogIn adc_vbat(ADC_VBAT); // Warning: Not available on all devices
00012 
00013 DigitalOut led(LED1);
00014 
00015 int main()
00016 {
00017     printf("\nSTM32 ADC internal channels reading example\n");
00018     while(1) {
00019         printf("ADC Temp = %f\n", adc_temp.read());
00020         printf("ADC VRef = %f\n", adc_vref.read());
00021         printf("ADC VBat = %f\n", adc_vbat.read());
00022         printf("\033[3A");
00023         led = !led;
00024         wait(1.0);
00025     }
00026 }
00027 
00028 #endif