*

Dependencies:   mbed-STM32F103C8T6 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "stm32f103c8t6.h"
00002 #include "mbed.h"
00003 
00004 // AnalogIn example
00005 // Reads analog data from a pin and prints it to the com port
00006 
00007 AnalogIn analog(PB_0);
00008 Serial com(PA_2, PA_3);
00009 
00010 float data = 0;
00011 
00012 int main()
00013 {
00014     confSysClock();     //Configure system clock (72MHz HSE clock, 48MHz USB clock)    
00015     com.baud(9600);
00016     
00017     while (1)
00018     {
00019         data = analog.read();
00020         com.printf("Analog data is: %.2f \r\n", data);
00021         wait(0.1);
00022     }    
00023 }