Nucleo_ADC

Dependencies:   mbed

Committer:
anoney180133
Date:
Fri Dec 11 14:20:22 2015 +0000
Revision:
0:b3f45f22272f
1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
anoney180133 0:b3f45f22272f 1 #include "mbed.h"
anoney180133 0:b3f45f22272f 2
anoney180133 0:b3f45f22272f 3 //------------------------------------
anoney180133 0:b3f45f22272f 4 // Hyperterminal configuration
anoney180133 0:b3f45f22272f 5 // 115200 bauds(Default 9600), 8-bit data, no parity
anoney180133 0:b3f45f22272f 6 //------------------------------------
anoney180133 0:b3f45f22272f 7 /* No need Serial to UART just usb debugger. */
anoney180133 0:b3f45f22272f 8
anoney180133 0:b3f45f22272f 9 Serial UART(SERIAL_TX, SERIAL_RX); // TX PA_2 , RX PA_3
anoney180133 0:b3f45f22272f 10
anoney180133 0:b3f45f22272f 11 AnalogIn ADC_Channel0(PA_0);
anoney180133 0:b3f45f22272f 12 AnalogIn ADC_Channel1(PA_1);
anoney180133 0:b3f45f22272f 13
anoney180133 0:b3f45f22272f 14
anoney180133 0:b3f45f22272f 15 void UARTIrq();
anoney180133 0:b3f45f22272f 16
anoney180133 0:b3f45f22272f 17
anoney180133 0:b3f45f22272f 18 int main()
anoney180133 0:b3f45f22272f 19 {
anoney180133 0:b3f45f22272f 20 UART.baud(115200); // Set BuadRate
anoney180133 0:b3f45f22272f 21 printf("Read ADC Testing.\r\n");
anoney180133 0:b3f45f22272f 22 while(1)
anoney180133 0:b3f45f22272f 23 {
anoney180133 0:b3f45f22272f 24 wait_ms(250);
anoney180133 0:b3f45f22272f 25 printf("ADC1_IN0(A0) = %d , ADC1_IN1(A1) = %d \r\n", ADC_Channel0.read_u16(),ADC_Channel1.read_u16());
anoney180133 0:b3f45f22272f 26 }
anoney180133 0:b3f45f22272f 27 }
anoney180133 0:b3f45f22272f 28