Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Nucleo_blink_led voltimetrofuncional
Revision 1:ad0edab33530, committed 2017-08-19
- Comitter:
- briandk
- Date:
- Sat Aug 19 21:57:50 2017 +0000
- Parent:
- 0:3d7ebc7de009
- Commit message:
- VOLTIMETRO DE 0 A 3,3 V
Changed in this revision
DECO.cpp | Show annotated file Show diff for this revision Revisions of this file |
DECO.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/DECO.cpp Sat Aug 12 21:17:45 2017 +0000 +++ b/DECO.cpp Sat Aug 19 21:57:50 2017 +0000 @@ -1,23 +1,48 @@ + + + # include "DECO.h" -#include "mbed.h" + +int SEG[16]= {0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18,0x08,0x03,0x0b,0x23,0x4f,0x20}; -int anod[16]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18,0x08,0x03,0x0b,0x23,0x4f,0x20}; -int sieteseg::entrada(PinName a,PinName b,PinName c,PinName d) -{ - BusIn dip (a,b,c,d); - dipSw= dip.read(); - return dipSw; +/*int anodo::entrada(PinName a,PinName b, PinName c,PinName d) + { + BusIn dip(a,b,c,d); + dipp= dip.read(); + return dipp; + }*/ -} - void sieteseg::Visual (PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g) - { + +void anodo::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 sieteseg::bcd (int number) + } + + +void anodo:: Disp(int number) + { + BusOut display (_g,_f,_e,_d,_c,_b,_a); + display=SEG[number]; + + } + + +void anodo::ConfEn(PinName one, PinName two,int uni,int dec,int time) { - BusOut display (_g,_f,_e,_d,_c,_b,_a); - display=anod[number]; + DigitalOut Edec(one); + DigitalOut Euni(two); + + for(int u=0; u<time; u++) + { + Edec=1; + Euni=0; + Disp(uni); + wait(0.005); + + Edec=0; + Euni=1; + Disp(dec); + wait(0.005); + } } - -
--- a/DECO.h Sat Aug 12 21:17:45 2017 +0000 +++ b/DECO.h Sat Aug 19 21:57:50 2017 +0000 @@ -2,16 +2,22 @@ #define DECO_h #include "mbed.h" -class sieteseg + +class anodo { - public: - int entrada(PinName a,PinName b,PinName c,PinName d); // la letra d es el bit mas significativo - 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 dipSw; +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 Disp(int number); + void ConfEn(PinName one, PinName two,int uni,int dec,int time); +private: + PinName _a; + PinName _b; + PinName _c; + PinName _d; + PinName _e; + PinName _f; + PinName _g; + int dipp; }; - -#endif \ No newline at end of file +#endif