Práctica 2 Ejercicio 4 A

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
anderibabe
Date:
Fri Nov 03 14:22:40 2017 +0000
Commit message:
Pr?ctica 2 Ejercicio 4 A

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 03 14:22:40 2017 +0000
@@ -0,0 +1,36 @@
+#include "mbed.h"
+
+InterruptIn Sw1(PB_0); // Switch1 conectado al pin A3
+InterruptIn Sw2(PC_1); // Switch2 conectado al pin A4
+InterruptIn Sw3(PC_0); // Switch3 conectado al pin A5
+DigitalOut Led1(PB_3); // Led1 conectado al pin D3
+DigitalOut Led2(PB_5); // Led2 conectado al pin D4
+DigitalOut Led3(PB_4); // Led3 conectado al pin D5
+int myled;
+void trigger1 ()
+{
+    Led1=myled;
+    myled=!myled;
+}
+
+void trigger2 ()
+{
+    Led2=myled;
+    myled=!myled;
+}
+
+void trigger3 ()
+{
+    Led3=myled;
+    myled=!myled;
+}
+
+int main()
+{
+    Sw1.rise(&trigger1);
+    Sw2.rise(&trigger2);
+    Sw3.rise(&trigger3);
+    while(1) {
+        sleep();
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Nov 03 14:22:40 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/fb8e0ae1cceb
\ No newline at end of file