código guía 2 sesión 1

Dependencies:   mbed

Fork of bdc_7seg by sergio burbano

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BCD_SEC.cpp Source File

BCD_SEC.cpp

00001 #include "BCD_SEC.h"
00002 int codhex[10]= {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18};//,0x08,0x03,0x0b,0x23,0x4f,0x20
00003 int anodo::entrada(PinName a,PinName b, PinName c,PinName d)
00004 {
00005     BusIn dip(a,b,c,d);
00006     dipp=dip.read();
00007     return dip;
00008 }
00009 void anodo::visual(PinName seg_a,PinName seg_b, PinName seg_c,PinName seg_d,PinName seg_e,PinName seg_f, PinName seg_g)
00010 {
00011     _a=seg_a;
00012     _b=seg_b;
00013     _c=seg_c;
00014     _d=seg_d;
00015     _e=seg_e;
00016     _f=seg_f;
00017     _g=seg_g;
00018 }
00019 void anodo:: BDC(int number)
00020 {
00021     BusOut display (_g,_f,_e,_d,_c,_b,_a);
00022     display=codhex[number];
00023 
00024 }
00025 void anodo::dual(PinName uno, PinName two,int unidad,int decena,int tiempo)
00026 {DigitalOut habilitador1(uno);
00027 DigitalOut habilitardor2(two);
00028     for(int u=0; u<tiempo; u++) {
00029         habilitador1=1;
00030         habilitardor2=0;
00031         BDC(unidad);
00032         wait(0.005);
00033         habilitador1=0;
00034         habilitardor2=1;
00035         BDC(decena);
00036         wait(0.005);
00037     }
00038 }