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.

Committer:
epremeaux
Date:
Tue Jul 09 02:23:18 2019 +0000
Revision:
2:17a5c34b3a79
Parent:
1:9a043ee174de
Added SD card examples. Had to roll back the MBED library to maintain SDFileSystem compatability

Who changed what in which revision?

UserRevisionLine numberNew contents of line
epremeaux 1:9a043ee174de 1 #ifdef COMPILE_ADC_Internal
epremeaux 1:9a043ee174de 2
epremeaux 1:9a043ee174de 3 /*
epremeaux 1:9a043ee174de 4 This basic example just shows how to read the ADC internal channels raw values.
epremeaux 1:9a043ee174de 5 Please look in the corresponding device reference manual for a complete
epremeaux 1:9a043ee174de 6 description of how to make a temperature sensor, VBat or Vref measurement.
epremeaux 1:9a043ee174de 7 */
epremeaux 1:9a043ee174de 8
epremeaux 1:9a043ee174de 9 AnalogIn adc_temp(ADC_TEMP);
epremeaux 1:9a043ee174de 10 AnalogIn adc_vref(ADC_VREF);
epremeaux 1:9a043ee174de 11 AnalogIn adc_vbat(ADC_VBAT); // Warning: Not available on all devices
epremeaux 1:9a043ee174de 12
epremeaux 1:9a043ee174de 13 DigitalOut led(LED1);
epremeaux 1:9a043ee174de 14
epremeaux 1:9a043ee174de 15 int main()
epremeaux 1:9a043ee174de 16 {
epremeaux 1:9a043ee174de 17 printf("\nSTM32 ADC internal channels reading example\n");
epremeaux 1:9a043ee174de 18 while(1) {
epremeaux 1:9a043ee174de 19 printf("ADC Temp = %f\n", adc_temp.read());
epremeaux 1:9a043ee174de 20 printf("ADC VRef = %f\n", adc_vref.read());
epremeaux 1:9a043ee174de 21 printf("ADC VBat = %f\n", adc_vbat.read());
epremeaux 1:9a043ee174de 22 printf("\033[3A");
epremeaux 1:9a043ee174de 23 led = !led;
epremeaux 1:9a043ee174de 24 wait(1.0);
epremeaux 1:9a043ee174de 25 }
epremeaux 1:9a043ee174de 26 }
epremeaux 1:9a043ee174de 27
epremeaux 1:9a043ee174de 28 #endif