nicolás rodríguez
/
BCD_GUIA2
7 segmetobcd
Revision 0:246c93030d74, committed 2017-08-12
- Comitter:
- nikor97r
- Date:
- Sat Aug 12 21:54:13 2017 +0000
- Commit message:
- 7 segmetobcd
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BCDSEG.cpp Sat Aug 12 21:54:13 2017 +0000 @@ -0,0 +1,21 @@ +#include "BCDSEG.h" + + +int anodo[10] = {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18}; + +int anodoo::entrada (PinName A, PinName B, PinName C, PinName D) +{ + BusIn dip(A,B,C,D); + Sw = dip.read(); + return Sw; + +} +void anodoo::visual(PinName A, PinName B, PinName C, PinName D, PinName E, PinName F, PinName G) +{ + _A=A; _B=B; _C=C; _D=D; _E=E; _F=F; _G=G; +} +void anodoo::bcd(int number) +{ + BusOut display(_G,_F,_E,_D,_C,_B,_A); + display=anodo[number]; +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/BCDSEG.h Sat Aug 12 21:54:13 2017 +0000 @@ -0,0 +1,17 @@ +#ifndef BCDSEG_h +#define BCDSEG_h +#include "mbed.h" + +class anodoo +{ + public: + int entrada(PinName A, PinName B, PinName C, PinName D); + void visual(PinName A, PinName B, PinName C, PinName D, PinName E, PinName F, PinName G ); + void bcd(int number); + private: + PinName _A;PinName _B; PinName _C; PinName _D; PinName _E; PinName _F; PinName _G; + int Sw; + +}; + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sat Aug 12 21:54:13 2017 +0000 @@ -0,0 +1,22 @@ +#include "BCDSEG.h" +#include "mbed.h" + +int numero; + +int main() +{ + anodoo peinado; + peinado.visual(D6,D7,D8,D9,D10,D11,D12); + while(1) + { + numero = peinado.entrada(D2,D3,D4,D5); + + + + peinado.bcd(numero); + wait(0.5); + + + + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 12 21:54:13 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file