/*############################################################# Program Name : ex2_analog_multiple Author : Grant Phillips Date Modified : 13/01/2016 Compiler : ARMmbed Tested On : STM32F4-Discovery Description : Example that measures analog voltages from 4 pin sources and displays the 16-bit results for each. The output is displayed on a PC using the Serial Wire Viewer (SWV). See the SWV examples for an explanation of the use of this feature. Requirements : * STM32F4-Discovery Board Circuit : * potentiometers (POTs) connected to PA2, PA3, PC1, and PC2 * A wire link between PB3 and pin6 of the SWD connector (CN2) as explained in the SWV examples section ##############################################################*/ #include "mbed.h" #include "SWO.h" SWO_Channel SWO; AnalogIn ain0(PA_2); AnalogIn ain1(PA_3); AnalogIn ain2(PC_1); AnalogIn ain3(PC_2); int main() { while(1) { SWO.printf("Ain0 %5d Ain1 %5d Ain2 %5d Ain3 %5d\n", ain0.read_u16(), ain1.read_u16(), ain2.read_u16(), ain3.read_u16()); wait(0.01); } }