Manejo de interrupciones para lectura de senal analoga.

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
javierdavid2006
Date:
Sat Feb 08 02:59:13 2020 +0000
Commit message:
Manejo de Interrupciones

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r fe729db7d621 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 08 02:59:13 2020 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+AnalogIn sensor(PB_0);
+Ticker flipper1;
+Ticker flipper2;
+DigitalOut led1(PD_13);
+DigitalOut led2(PD_8);
+float valor_analogo; 
+Serial device(PA_2,PA_3);
+ 
+void flip1()   // flip 1 function
+{
+    valor_analogo=sensor.read();
+    device.printf("El valor analogo es en el timmer_1: %f \r\n", valor_analogo);
+
+}
+ 
+void flip2()   // flip 2 function
+{
+    valor_analogo=sensor.read();
+    device.printf("El valor analogo es en timmer_2: %f \r\n", valor_analogo);
+
+}
+int main()
+{
+    device.baud(9600);//Velocidad de Comunicacion
+    led1 = 0;
+    led2 = 0;
+ 
+    flipper1.attach(&flip1, 0.2); // the address of the
+// function to be attached
+// and the interval (sec)
+    flipper2.attach(&flip2, 1.0);
+// spin in a main loop
+// flipper will interrupt it to call flip
+ 
+    while(1) {
+        wait(0.2);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r fe729db7d621 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Feb 08 02:59:13 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file