![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Using the Timer to test the maximum speed of the ADC and DAC
main.cpp
- Committer:
- tgartlan
- Date:
- 2017-03-07
- Revision:
- 0:23ff2f1bb142
- Child:
- 1:6bb2d13644e8
File content as of revision 0:23ff2f1bb142:
#include "mbed.h" Timer t; Serial pc(USBTX, USBRX); AnalogOut Aout(p18); AnalogIn Ain(p20); DigitalOut myled(LED1); int main() { float value = 0; unsigned short value2 = 0; while(1) { t.start(); pc.printf("Hello World!\n\r"); t.stop(); pc.printf("time take was %f seconds\n", t.read()); t.reset(); myled = 1; wait(2); myled = 0; wait(2); pc.printf("Testing ADC time!\n\r"); t.reset(); t.start(); //value = Ain; value2 = Ain.read_u16(); t.stop(); pc.printf("ADC took %f seconds\n", t.read()); wait(2); pc.printf("Testing DAC time!\n\r"); t.reset(); t.start(); Aout =value; t.stop(); pc.printf("DAC took %f seconds\n", t.read()); wait(2); } }