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.
Revision 0:d994dd919d32, committed 2016-08-20
- Comitter:
- Digitalesavanzados
- Date:
- Sat Aug 20 19:15:25 2016 +0000
- Commit message:
- Voltimetro digital
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Volti.cpp Sat Aug 20 19:15:25 2016 +0000
@@ -0,0 +1,62 @@
+#include "Volti.h"
+
+int x,y,z, unim=0, deco[10]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
+double x1,x2,ent;
+
+void voltime::configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g, PinName p, PinName kuni, PinName kdec,PinName kcen,PinName kunim)
+{
+
+ _a=a;
+ _b=b;
+ _c=c;
+ _d=d;
+ _e=e;
+ _f=f;
+ _g=g;
+ _p=p;
+ _kuni=kuni;
+ _kdec=kdec;
+ _kcen=kcen;
+ _kunim=kunim;
+
+}
+
+void voltime::vol(double ent)
+{
+
+ BusOut disp(_a,_b,_c,_d,_e,_f,_g);
+ DigitalOut p=_p;
+ DigitalOut kuni=_kuni;
+ DigitalOut kdec=_kdec;
+ DigitalOut kcen=_kcen;
+ DigitalOut kunim=_kunim;
+ ent = ent * 0.000050354;
+ x = ent;
+ x1 = ent - x;
+ x2 = x1 * 100;
+ y = x2 / 10;
+ z = x2 - (y*10);
+
+ disp=deco[x];
+ kcen=1;
+ p=1;
+ wait(0.007);
+ kcen=0;
+ p=0;
+
+ disp=deco[y];
+ kdec=1;
+ wait(0.007);
+ kdec=0;
+
+ disp=deco[z];
+ kuni=1;
+ wait(0.007);
+ kuni=0;
+
+ disp=deco[unim];
+ kunim=1;
+ wait(0.007);
+ kunim=0;
+
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Volti.h Sat Aug 20 19:15:25 2016 +0000
@@ -0,0 +1,29 @@
+#ifndef Volti
+#define Volti_h
+#include "mbed.h"
+
+class voltime
+{
+
+public:
+
+ void configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g, PinName p,PinName kuni, PinName kdec,PinName kcen,PinName kunim);
+ void vol(double ent);
+
+private:
+
+ PinName _a;
+ PinName _b;
+ PinName _c;
+ PinName _d;
+ PinName _e;
+ PinName _f;
+ PinName _g;
+ PinName _p;
+ PinName _kuni;
+ PinName _kdec;
+ PinName _kcen;
+ PinName _kunim;
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 20 19:15:25 2016 +0000
@@ -0,0 +1,18 @@
+#include "Volti.h"
+
+AnalogIn lec(A0);
+
+int main()
+{
+ double meas;
+ voltime lab2;
+ lab2.configout(D2,D3,D4,D5,D6,D7,D8,D9,D10,D11,D12,D13);
+
+ while(1) {
+
+ meas = lec.read_u16();
+ lab2.vol(meas);
+ }
+
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 20 19:15:25 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/2241e3a39974 \ No newline at end of file