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:a70d5bbd557c, committed 2017-08-19
- Comitter:
- LCRodriguez
- Date:
- Sat Aug 19 21:51:03 2017 +0000
- Commit message:
- Volti7Seg
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BCDSEG.h Sat Aug 19 21:51:03 2017 +0000
@@ -0,0 +1,17 @@
+#ifndef BCDSEG_h
+#define BSDSEG_h
+#include "mbed.h"
+
+class And
+{
+ public:
+ int entrada(PinName a,PinName b,PinName c,PinName d);
+ void ve(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g);
+ void bcd(int number);
+ void doble(PinName uno,PinName dos,int Uni, int Dec, int time);
+ private:
+ PinName a_;PinName b_;PinName c_;PinName d_;PinName e_;PinName f_;PinName g_;
+ int dipS;
+};
+
+#endif
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/BDCSEG.cpp Sat Aug 19 21:51:03 2017 +0000
@@ -0,0 +1,35 @@
+#include "BCDSEG.h"
+
+int An[10]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18};
+int And::entrada(PinName a,PinName b,PinName c,PinName d)
+{
+ BusIn dip(a,b,c,d);
+ dipS=dip.read();
+ return dipS;
+}
+void And::ve(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g)
+{
+ a_=a;b_=b;c_=c;d_=d;e_=e;f_=f;g_=g;
+
+}
+void And::bcd(int number)
+{
+ BusOut display(g_,f_,e_,d_,c_,b_,a_);
+ display=An[number];
+}
+void And::doble(PinName uno, PinName dos, int Uni, int Dec,int time)
+{
+ DigitalOut Euno(uno);
+ DigitalOut Edos(dos);
+ for(int x=0;x<time;x++)
+ {
+ Euno=1;
+ Edos=0;
+ bcd(Uni);
+ wait(0.0005);
+ Euno=0;
+ Edos=1;
+ bcd(Dec);
+ wait(0.0005);
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Aug 19 21:51:03 2017 +0000
@@ -0,0 +1,23 @@
+#include "BCDSEG.h"
+
+Serial pc(USBTX,USBRX);
+AnalogIn Poten(A0);
+int Unid,Dece;
+float Vol;
+int main()
+{
+ And segm;
+ segm.ve(D6,D7,D8,D9,D10,D11,D12);
+ while(1)
+ {
+
+ Vol=Poten.read_u16()*0.00005;
+ Dece=Vol;
+ Unid=(Vol*10)-(Dece*10);
+ segm.doble(D4,D5,Unid,Dece,50);
+ //pc.printf("Voltaje :%0.2f\r",Vol);
+ //wait(0.06);
+
+ }
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Aug 19 21:51:03 2017 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d \ No newline at end of file