asdasd

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
dimmu8410
Date:
Fri Jul 06 19:23:22 2018 +0000
Commit message:
asdasd

Changed in this revision

BCDSEG.cpp Show annotated file Show diff for this revision Revisions of this file
BCDSEG.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BCDSEG.cpp	Fri Jul 06 19:23:22 2018 +0000
@@ -0,0 +1,34 @@
+#include "BCDSEG.h"
+int anod[16]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x58,0x00,0x18,0x08,0x03,0x0b,0x23,0x4f,0x20};
+int anodo::entrada(PinName a,PinName b,PinName c,PinName d)
+{
+    BusIn dip(a,b,c,d);
+    dipSw=dip.read();
+    return dipSw;
+}
+void anodo::visual(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 anodo::bcd(int number)
+{
+     BusOut display(_g,_f,_e,_d,_c,_b,_a);
+     display=anod[number];
+}
+void anodo::dual(PinName one,PinName two,int uni,int dec,int time)
+{
+    DigitalOut Eone(one);
+    DigitalOut Etwo(two);
+    for(int u=0;u<time;u++)
+           {
+            Eone=1;
+            Etwo=0;
+            bcd(uni);
+            wait(0.0005);
+            Eone=0;
+            Etwo=1;
+            bcd(dec);
+            wait(0.0005);
+           }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/BCDSEG.h	Fri Jul 06 19:23:22 2018 +0000
@@ -0,0 +1,16 @@
+#ifndef BCDSEG_h
+#define BCDSEG_h
+#include "mbed.h"
+class anodo
+{
+    public:
+    int entrada(PinName a,PinName b,PinName c,PinName d);//la letra d es el bit más significativo
+    void visual(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g);//
+    void bcd(int number);
+    void dual(PinName one,PinName two,int uni,int dec,int time);
+    private:
+    PinName _a;PinName _b;PinName _c;PinName _d;PinName _e;PinName _f;PinName _g;
+    int dipSw;
+};
+
+#endif
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Jul 06 19:23:22 2018 +0000
@@ -0,0 +1,21 @@
+#include "BCDSEG.h"
+
+Serial pc(USBTX,USBRX);
+AnalogIn pot(A0);
+int unic,decc;
+float voltage;
+int main() {
+    anodo leidy;
+    leidy.visual(D6,D7,D8,D9,D10,D11,D12);// EN EL DISPLAY EL ORDEN ES (G,F,E,D,C,B,A);
+    while(1) 
+    {
+           voltage=pot.read_u16()*0.00005;
+           //pc.printf("la lectura: %0.2f\r", voltage);
+           //wait(0.5);
+           decc=voltage;
+           unic=(voltage*10)-(decc*10);    
+           leidy.dual(D4,D5,unic,decc,50);
+       
+    }
+          
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Jul 06 19:23:22 2018 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/fd96258d940d
\ No newline at end of file