John Dickerson
/
AnalogOutIn
Sine wave out DAC and received in ADC and then sent out serial port
Diff: main.cpp
- Revision:
- 0:8f5eafbf1fa2
diff -r 000000000000 -r 8f5eafbf1fa2 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Fri Jun 05 23:51:16 2015 +0000 @@ -0,0 +1,24 @@ +#include "mbed.h" + +AnalogOut aout(PTE30); +AnalogIn ain(PTC2); +Serial pc(USBTX,USBRX); +DigitalOut myled(LED_GREEN); + +int main() { + int i=0; + float g[100]; + myled=0; + while(i<100) { + aout = (1.0+(sin(2*3.14159*i/100.0)))/2.0; + g[i]= ain; + wait(.01); + myled = !myled; + i++; + } + i=0; + while(i<100) { + pc.printf("%f \n",g[i]); + i++; + } +}