//conversor de bcd a 7 segmentos

Dependencies:   mbed

Committer:
cristiany
Date:
Sat Aug 19 21:50:37 2017 +0000
Revision:
1:c773d22f95b3
Parent:
0:da3425777443
ADC WITH LEDS

Who changed what in which revision?

UserRevisionLine numberNew contents of line
cristiany 1:c773d22f95b3 1 //ADC Conversor with Leds' Ruler
cristiany 0:da3425777443 2
cristiany 0:da3425777443 3 //Cristian Yomayuza
cristiany 0:da3425777443 4 //Anderson Murte
cristiany 0:da3425777443 5 //Arley Rueda
cristiany 0:da3425777443 6
cristiany 0:da3425777443 7 #include "seg.h"
cristiany 1:c773d22f95b3 8
cristiany 1:c773d22f95b3 9 AnalogIn analog_value(A0);
cristiany 1:c773d22f95b3 10 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};
cristiany 1:c773d22f95b3 11 float Lectura;
cristiany 1:c773d22f95b3 12 int Local;
cristiany 1:c773d22f95b3 13 int main()
cristiany 1:c773d22f95b3 14 {
cristiany 1:c773d22f95b3 15 cod obj;
cristiany 1:c773d22f95b3 16 obj.salida(D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13);
cristiany 0:da3425777443 17 while(1)
cristiany 0:da3425777443 18 {
cristiany 1:c773d22f95b3 19 Lectura=analog_value.read_u16()*0.00005;
cristiany 1:c773d22f95b3 20
cristiany 1:c773d22f95b3 21
cristiany 1:c773d22f95b3 22 for(int i=0;i<14;i++)
cristiany 1:c773d22f95b3 23 {
cristiany 1:c773d22f95b3 24 if(Lectura<=Vvolt[i])
cristiany 1:c773d22f95b3 25 {
cristiany 1:c773d22f95b3 26 Local=i;
cristiany 1:c773d22f95b3 27 break;
cristiany 1:c773d22f95b3 28 }
cristiany 1:c773d22f95b3 29
cristiany 1:c773d22f95b3 30
cristiany 1:c773d22f95b3 31 }
cristiany 1:c773d22f95b3 32 obj.leds(Local);
cristiany 1:c773d22f95b3 33 wait(0.9);
cristiany 1:c773d22f95b3 34
cristiany 1:c773d22f95b3 35
cristiany 1:c773d22f95b3 36
cristiany 1:c773d22f95b3 37
cristiany 0:da3425777443 38 }
cristiany 0:da3425777443 39 }