Seleccion_Lectura_Analoga

Dependencies:   mbed

main.cpp

Committer:
javierdavid2006
Date:
2020-02-01
Revision:
0:54b929652f60

File content as of revision 0:54b929652f60:

#include "mbed.h"
Serial device(PA_2,PA_3);
AnalogIn    ain1(PB_0);
AnalogIn    ain2(PB_1);
DigitalIn i(PA_0);



int main()
{
    device.baud(115200);

    while(1) {
        int b = 0;
        if (b==0 and i == 1) {
            float POT =  ain1.read();
            device.printf("EL valor analogo AIN1 es : %f \r\n", POT);
            b=1;
            wait(0.5);
            if (b==1 and i == 1) {
                float POT =  ain2.read();
                device.printf("EL valor analogo AIN2 es: %f \r\n", POT);
                wait(0.5);
                b=0;
            }
        }
    }


}