CRISTIAN YOMAYUZA
/
dec_seg_
//conversor de bcd a 7 segmentos
Diff: main.cpp
- Revision:
- 1:c773d22f95b3
- Parent:
- 0:da3425777443
--- a/main.cpp Sat Aug 12 21:44:02 2017 +0000 +++ b/main.cpp Sat Aug 19 21:50:37 2017 +0000 @@ -1,21 +1,39 @@ -//conversor de bcd a 7 segmentos +//ADC Conversor with Leds' Ruler //Cristian Yomayuza //Anderson Murte //Arley Rueda -#include "mbed.h" #include "seg.h" - -int number; -int main() -{ - cod yoma; - yoma.salida(D6,D7,D8,D9,D10,D11,D12); + +AnalogIn analog_value(A0); +float Vvolt[13]={0,0.275,0.55,0.825,1.1,1.3,1.6,1.9,2.2,2.4,2.7,3,3.3}; +float Lectura; +int Local; +int main() + { + cod obj; + obj.salida(D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13); while(1) { - number=yoma.enter(D2,D3,D4,D5); - yoma.bcd(number); - wait(0.5); + Lectura=analog_value.read_u16()*0.00005; + + + for(int i=0;i<14;i++) + { + if(Lectura<=Vvolt[i]) + { + Local=i; + break; + } + + + } + obj.leds(Local); + wait(0.9); + + + + } }