Dependencies:   mbed

Committer:
jlemap
Date:
Sat Feb 08 03:08:14 2020 +0000
Revision:
0:21869cfbd794
DIENTE DE SIERRA

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jlemap 0:21869cfbd794 1 #include "mbed.h"
jlemap 0:21869cfbd794 2 Serial PC(PA_2,PA_3,115200);
jlemap 0:21869cfbd794 3
jlemap 0:21869cfbd794 4 AnalogOut Aout (PA_4);
jlemap 0:21869cfbd794 5 AnalogIn Ain (PC_1);
jlemap 0:21869cfbd794 6 float lectura;
jlemap 0:21869cfbd794 7 float i=0;
jlemap 0:21869cfbd794 8
jlemap 0:21869cfbd794 9 int main() {
jlemap 0:21869cfbd794 10 while(1) {
jlemap 0:21869cfbd794 11 for (i=0; i<1; i++){
jlemap 0:21869cfbd794 12 Aout =1;
jlemap 0:21869cfbd794 13 lectura=Ain.read();
jlemap 0:21869cfbd794 14 PC.printf("%1.0f \r\n",lectura);
jlemap 0:21869cfbd794 15 wait(0.5);
jlemap 0:21869cfbd794 16 }
jlemap 0:21869cfbd794 17 for (i=0; i<1; i++){
jlemap 0:21869cfbd794 18 Aout =0;
jlemap 0:21869cfbd794 19 lectura=Ain.read();
jlemap 0:21869cfbd794 20 PC.printf("%1.0f \r\n",lectura);
jlemap 0:21869cfbd794 21 wait(0.5);
jlemap 0:21869cfbd794 22 }
jlemap 0:21869cfbd794 23 }
jlemap 0:21869cfbd794 24 }