John Dickerson
/
AnalogOutIn
Sine wave out DAC and received in ADC and then sent out serial port
main.cpp
- Committer:
- JohnDickerson
- Date:
- 2015-06-05
- Revision:
- 0:8f5eafbf1fa2
File content as of revision 0:8f5eafbf1fa2:
#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++; } }