Seleccion_Lectura_Analoga

Dependencies:   mbed

Revision:
0:54b929652f60
diff -r 000000000000 -r 54b929652f60 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 01 19:15:08 2020 +0000
@@ -0,0 +1,30 @@
+#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;
+            }
+        }
+    }
+
+
+}