Luis Silvio Cordova Rivadeneira
/
UPSM_Analog_Input_Output
ejemplos varios
descripcion o resumen
pie de la imagen con explicacion
practica desarrollo, etc
concluciones
Diff: main.cpp
- Revision:
- 0:16fd5df34260
diff -r 000000000000 -r 16fd5df34260 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Feb 06 23:52:17 2020 +0000 @@ -0,0 +1,49 @@ +//Reads input through the ADC, and transfers to PC terminal +#include "mbed.h" +Serial pc(PA_2,PA_3);; +AnalogIn Ain(PB_0); + +float ADCdata; + +int main() +{ + pc.printf("ADC Data Values... \n\r"); + while (1) { + ADCdata=Ain; + pc.printf("%f \n\r",ADCdata); + wait (0.5); + } +} + +/* + +#include "mbed.h" +int main() +{ + AnalogOut Aout(p18); + while(1) { + Aout=0.25; // 0.25*3.3V = 0.825V + wait(1); + Aout=0.5; // 0.5*3.3V = 1.65V + wait(1); + Aout=0.75; // 0.75*3.3V = 2.475V + wait(1); + } +} +*/ + +/* +//Sawtooth waveform on DAC output to view on oscilloscope +#include "mbed.h" +AnalogOut Aout(p18); +float i; +int main() +{ + while(1) { + for (i=0; i<1; i=i+0.1) { + Aout=i; + wait(0.001); + } + } +} +*/ \ No newline at end of file