Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 /*Program Example 5.5: Inputs signal through ADC, and outputs to DAC. 00002 View DAC output on oscilloscope. To demonstrate Nyquist, connect variable 00003 frequency signal generator to ADC input. Allows measurement of conversion 00004 times, and explores Nyquist limit. 00005 */ 00006 #include "mbed.h" 00007 AnalogOut Aout(p18); //defines analog output on Pin 18 00008 AnalogIn Ain(p20); //defines analog input on Pin 20 00009 DigitalOut test(p5); 00010 float ADCdata; 00011 00012 int main() { 00013 while(1) { 00014 ADCdata=Ain; //starts A-D conversion, and assigns analog value to ADCdata 00015 test=1; //switch test output, as time marker 00016 test=0; 00017 Aout=ADCdata; // transfers stored value to DAC, and forces a D-A conversion 00018 test=1; //a double pulse, to mark the end of conversion 00019 test=0; 00020 test=1; 00021 test=0; 00022 //wait(0.001); //optional wait state, to explore different cycle times 00023 } 00024 } 00025
Generated on Tue Aug 23 2022 14:58:37 by
1.7.2