código guía 2 sesión 1

Dependencies:   mbed

Fork of bdc_7seg by sergio burbano

Revision:
2:7dcd61e90e19
Parent:
1:64569742f2ec
--- a/BCD_SEC.cpp	Sat Aug 12 21:03:54 2017 +0000
+++ b/BCD_SEC.cpp	Sat Aug 19 21:37:03 2017 +0000
@@ -1,18 +1,38 @@
 #include "BCD_SEC.h"
-int codhex[16]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18,0x08,0x03,0x0b,0x23,0x4f,0x20};
+int codhex[10]= {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18};//,0x08,0x03,0x0b,0x23,0x4f,0x20
 int anodo::entrada(PinName a,PinName b, PinName c,PinName d)
 {
     BusIn dip(a,b,c,d);
     dipp=dip.read();
     return dip;
-    }
+}
 void anodo::visual(PinName seg_a,PinName seg_b, PinName seg_c,PinName seg_d,PinName seg_e,PinName seg_f, PinName seg_g)
 {
-    _a=seg_a;_b=seg_b;_c=seg_c;_d=seg_d;_e=seg_e;_f=seg_f;_g=seg_g;
-    }
+    _a=seg_a;
+    _b=seg_b;
+    _c=seg_c;
+    _d=seg_d;
+    _e=seg_e;
+    _f=seg_f;
+    _g=seg_g;
+}
 void anodo:: BDC(int number)
 {
     BusOut display (_g,_f,_e,_d,_c,_b,_a);
-display=codhex[number];
-    
-    }
\ No newline at end of file
+    display=codhex[number];
+
+}
+void anodo::dual(PinName uno, PinName two,int unidad,int decena,int tiempo)
+{DigitalOut habilitador1(uno);
+DigitalOut habilitardor2(two);
+    for(int u=0; u<tiempo; u++) {
+        habilitador1=1;
+        habilitardor2=0;
+        BDC(unidad);
+        wait(0.005);
+        habilitador1=0;
+        habilitardor2=1;
+        BDC(decena);
+        wait(0.005);
+    }
+}
\ No newline at end of file