DipCortex - Read 7 Analog channels and stream the data over USB CDC
Fork of DipCortex-ADC-USB by
Read 7 analog channels and stream the results over a USB CDC connection. Using the DIpCortex
Diff: main.cpp
- Revision:
- 0:21219957a1ae
- Child:
- 1:ec3a6a7c1aba
diff -r 000000000000 -r 21219957a1ae main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Nov 02 12:22:33 2013 +0000 @@ -0,0 +1,26 @@ +/** + * USB ADC - Stream 7 ADC channels over USB CDC + */ + +#include "mbed.h" +#include "USBSerial.h" + +USBSerial pc; + +// Configure the Analogue pins of the DipCortex +AnalogIn adc0(p2); +AnalogIn adc1(p3); +AnalogIn adc2(p4); +AnalogIn adc3(p5); +AnalogIn adc5(p8); +AnalogIn adc6(p9); +AnalogIn adc7(p10); + +int main() +{ + while (1) + { + pc.printf("ADC0, %d, ADC1, %d, ADC2, %d, ADC3, %d, ADC5, %d, ADC6, %d, ADC7, %d\r\n", adc0.read_u16(), adc1.read_u16(), adc2.read_u16(), adc3.read_u16(), adc5.read_u16(), adc6.read_u16(), adc7.read_u16()); + } +} +