Leonel Pérez Montes / Mbed 2 deprecated P5_3_Secuencias

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
LeoPM
Date:
Thu Nov 29 03:54:53 2018 +0000
Commit message:
Secuencias;

Changed in this revision

P5_3_Secuencias.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/P5_3_Secuencias.cpp	Thu Nov 29 03:54:53 2018 +0000
@@ -0,0 +1,131 @@
+#include "mbed.h"
+
+#define DI1 0x80
+#define DI2 0x40
+#define DI3 0x20
+#define DI4 0x10
+#define DI5 0x08
+#define DI6 0x04
+#define DI7 0x02
+#define DI8 0x01
+#define apagado 0x00
+#define extremos 0x90
+#define internos 0x60
+//#define parpadeo 0x03
+
+BusOut LEDSO(D4,D5,D6,D7,D8,D9,D10,D11);
+InterruptIn button1(D14);
+InterruptIn button2(D2);
+InterruptIn button3(D12);
+InterruptIn button4(D13);
+
+void AccionPin1(){
+    for(int i=0;i<2;i++){
+        LEDSO=DI1;
+        wait(0.3); 
+        LEDSO=DI2;
+        wait(0.3);  
+        LEDSO=DI3;
+        wait(0.3); 
+        LEDSO=DI4;
+        wait(0.3);
+        LEDSO=DI5;
+        wait(0.3); 
+        LEDSO=DI6;
+        wait(0.3);  
+        LEDSO=DI7;
+        wait(0.3); 
+        LEDSO=DI8;
+        wait(0.3);
+        LEDSO=DI7;
+        wait(0.3); 
+        LEDSO=DI6;
+        wait(0.3);  
+        LEDSO=DI5;
+        wait(0.3); 
+        LEDSO=DI4;
+        wait(0.3);
+        LEDSO=DI3;
+        wait(0.3); 
+        LEDSO=DI2;
+        wait(0.3);  
+        LEDSO=DI1;
+        wait(0.3); 
+        LEDSO=apagado;
+    }
+}
+
+void AccionPin2(){
+    for(int i=0;i<3;i++){
+        LEDSO=DI1;
+        wait(0.3); 
+        LEDSO=DI2;
+        wait(0.3);  
+        LEDSO=DI3;
+        wait(0.3); 
+        LEDSO=DI4;
+        wait(0.3);
+        LEDSO=DI5;
+        wait(0.3); 
+        LEDSO=DI6;
+        wait(0.3);  
+        LEDSO=DI7;
+        wait(0.3); 
+        LEDSO=DI8;
+        wait(0.3);
+        LEDSO=DI7;
+        wait(0.3); 
+        LEDSO=DI6;
+        wait(0.3);  
+        LEDSO=DI5;
+        wait(0.3); 
+        LEDSO=DI4;
+        wait(0.3);
+        LEDSO=DI3;
+        wait(0.3); 
+        LEDSO=DI2;
+        wait(0.3);  
+        LEDSO=DI1;
+        wait(0.3); 
+        LEDSO=apagado;
+    }
+}
+
+void AccionPin3(){
+    for(int i=0;i<4;i++){
+        LEDSO=extremos;
+        wait(0.3); 
+        LEDSO=apagado;
+        wait(0.3);  
+        LEDSO=internos;
+        wait(0.3); 
+        LEDSO=apagado;
+    }
+}
+
+void AccionPin4(){
+    for(int i=0;i<5;i++){
+        LEDSO=internos;
+        wait(0.3); 
+        LEDSO=apagado;
+        wait(0.3);  
+        LEDSO=extremos;
+        wait(0.3); 
+        LEDSO=apagado;
+    }
+}
+
+int main() {
+    while(1){
+    button1.rise(&AccionPin1);
+    button2.rise(&AccionPin2);
+    button3.rise(&AccionPin3);
+    button4.rise(&AccionPin4);
+    /*while(button1==0||button2==0||button3==0||button4==0){
+        LEDSO=parpadeo;
+        wait(1); 
+        LEDSO=apagado;
+        wait(1);  
+        }*/
+}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 29 03:54:53 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file