nicolás rodríguez
/
BCD_GUIA2PT2
Voltímetro ADC y BCD
Fork of BCD_GUIA2 by
Revision 1:b6f946fdfb2f, committed 2017-08-19
- Comitter:
- nikor97r
- Date:
- Sat Aug 19 21:44:23 2017 +0000
- Parent:
- 0:246c93030d74
- Commit message:
- Volt?metro ADC y BCD
Changed in this revision
diff -r 246c93030d74 -r b6f946fdfb2f BCDSEG.cpp --- a/BCDSEG.cpp Sat Aug 12 21:54:13 2017 +0000 +++ b/BCDSEG.cpp Sat Aug 19 21:44:23 2017 +0000 @@ -18,4 +18,20 @@ { BusOut display(_G,_F,_E,_D,_C,_B,_A); display=anodo[number]; +} +void anodoo::dual(PinName uno, PinName dos, int unidades, int decenas, int tiempo) +{ + DigitalOut enable1(uno); + DigitalOut enable2(dos); + for (int i = 0; i<tiempo;i++) + { + enable1=1; + enable2=0; + bcd(unidades); + wait(0.002); + enable1=0; + enable2=1; + bcd(decenas); + wait(0.002); + } } \ No newline at end of file
diff -r 246c93030d74 -r b6f946fdfb2f BCDSEG.h --- a/BCDSEG.h Sat Aug 12 21:54:13 2017 +0000 +++ b/BCDSEG.h Sat Aug 19 21:44:23 2017 +0000 @@ -8,6 +8,7 @@ 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); + void dual(PinName uno, PinName dos, int unidades, int decenas, int tiempo); private: PinName _A;PinName _B; PinName _C; PinName _D; PinName _E; PinName _F; PinName _G; int Sw;
diff -r 246c93030d74 -r b6f946fdfb2f main.cpp --- a/main.cpp Sat Aug 12 21:54:13 2017 +0000 +++ b/main.cpp Sat Aug 19 21:44:23 2017 +0000 @@ -1,22 +1,18 @@ #include "BCDSEG.h" -#include "mbed.h" int numero; - -int main() +AnalogIn pot(A0); +float p; +int unid,dece; +int main() { - anodoo peinado; - peinado.visual(D6,D7,D8,D9,D10,D11,D12); - while(1) + 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); - - - + p = (pot.read_u16()*0.00005); + dece=p; + unid=(p*10)-(dece*10); + peinado.dual(D4,D5,unid,dece,100); } -} +} \ No newline at end of file