nicolás rodríguez / Mbed 2 deprecated BCD_GUIA2PT2

Dependencies:   mbed

Fork of BCD_GUIA2 by nicolás rodríguez

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers BCDSEG.cpp Source File

BCDSEG.cpp

00001 #include "BCDSEG.h"
00002 
00003 
00004 int anodo[10] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18};
00005 
00006 int anodoo::entrada (PinName A, PinName B, PinName C, PinName D)
00007 {
00008     BusIn dip(A,B,C,D); 
00009     Sw = dip.read();
00010     return Sw;
00011     
00012 }
00013 void anodoo::visual(PinName A, PinName B, PinName C, PinName D, PinName E, PinName F, PinName G)
00014 {
00015     _A=A; _B=B; _C=C; _D=D; _E=E; _F=F; _G=G;
00016 }
00017 void anodoo::bcd(int number)
00018 {
00019     BusOut display(_G,_F,_E,_D,_C,_B,_A); 
00020     display=anodo[number];
00021 }
00022 void anodoo::dual(PinName uno, PinName dos, int unidades, int decenas, int tiempo)
00023 {
00024     DigitalOut enable1(uno);
00025     DigitalOut enable2(dos);
00026     for (int i = 0; i<tiempo;i++)
00027     {
00028         enable1=1;
00029         enable2=0;
00030         bcd(unidades);
00031         wait(0.002);
00032         enable1=0;
00033         enable2=1;
00034         bcd(decenas);
00035         wait(0.002);
00036     }
00037 }