voltimetro LCD, 7seg_4digitos

Dependencies:   mbed TextLCD

Files at this revision

API Documentation at this revision

Comitter:
birda
Date:
Mon Jun 15 18:06:24 2020 +0000
Parent:
0:288eb4592f41
Commit message:
a;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 288eb4592f41 -r aedb77569443 main.cpp
--- a/main.cpp	Fri Jun 12 23:54:02 2020 +0000
+++ b/main.cpp	Mon Jun 15 18:06:24 2020 +0000
@@ -8,12 +8,12 @@
 int entero, decimal;
 double volt_in;
 
-BusOut display(PA_15,PB_7,PC_13,PC_14,PC_15,PH_0,PH_1);//pines en la placa
-BusOut Trans(PA_13,PA_14); //pin para los transistores
+BusOut display(PA_10,PB_3,PB_5,PB_4,PB_10,PA_8,PA_9);//pines en la placa
+BusOut Trans(PB_13,PB_14); //pin para los transistores, entrada Volt7seg
+DigitalOut Indecimal (PC_7);//punto decimal
 void ver();
 void incre();
-int unidad;
-int decena;
+int decimas;
 int conteo;
 const char seg[10]= {0x40,0x79,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90};
 Ticker visualizar;
@@ -28,7 +28,7 @@
             Trans =0;
             break;
         case 1:
-            display = seg[unidad];
+            display = seg[decimas];
             Trans=1;
             break;
         case 2:
@@ -36,7 +36,7 @@
             Trans =0;
             break;
         case 3:
-            display = seg[decena];
+            display = seg[entero];
             Trans=2;
             break;
     }
@@ -45,15 +45,18 @@
         conteo=0;
     }
 }
+
+
+
 void incre()
 {
-    if (unidad<9) {
-        unidad++;
-    } else {
-        decena++;
-        unidad=0;
-        if(decena==10)decena=0;
-    }
+
+            volt_in= entrada.read();
+        volt_in = volt_in*3300;
+        voltaje = int(volt_in);
+        entero = voltaje/1000;
+        decimal = voltaje%1000;
+        decimas = decimal/100;
 }