A collection of examples organized from basics to advanced.

Dependencies:   mbed SDFileSystem

Mbed online compiler has no facility to easily manage a lot of programs or organized them in to related folders. This makes creating an examples and sample pack difficult.

This repository contains a single main.cpp file (which does very little), and a BuildOptions.h file. Simply uncomment the example you would like to compile from the build options. Each example is wrapped in a compiler directive.

If the directive does not include a description comment, it likely does not exist yet. If you would like to contribute to the Examples project, please contact me or fork and issue a pull request.

Revision:
1:9a043ee174de
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/03_Analog/ADC_Internal.cpp	Fri Jul 05 04:52:18 2019 +0000
@@ -0,0 +1,28 @@
+#ifdef COMPILE_ADC_Internal  
+
+/*
+   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);
+    }
+}
+
+#endif