Visualización dinamica

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
DanielOlarte
Date:
Sat Aug 20 14:15:52 2016 +0000
Commit message:
Visualizaci?n dinamica

Changed in this revision

VisDinam.cpp Show annotated file Show diff for this revision Revisions of this file
VisDinam.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/VisDinam.cpp	Sat Aug 20 14:15:52 2016 +0000
@@ -0,0 +1,66 @@
+#include "VisDinam.h"
+
+int uni=0,dec=0,cent=0,unim=0, deco[10]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
+
+
+void visdi::configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g, PinName kuni, PinName kdec,PinName kcen,PinName kunim)
+{
+
+    _a=a;
+    _b=b;
+    _c=c;
+    _d=d;
+    _e=e;
+    _f=f;
+    _g=g;
+    _kuni=kuni;
+    _kdec=kdec;
+    _kcen=kcen;
+    _kunim=kunim;
+
+}
+
+void visdi::vis()
+{
+
+    BusOut disp(_a,_b,_c,_d,_e,_f,_g);
+    DigitalOut kuni=_kuni;
+    DigitalOut kdec=_kdec;
+    DigitalOut kcen=_kcen;
+    DigitalOut kunim=_kunim;
+
+    for(int unim=0; unim<10; unim++) {
+
+        for(int cen=0; cen<10; cen++) {
+
+            for(int dec=0; dec<10; dec++) {
+
+                for(int uni=0; uni<10; uni++) {
+
+                    for(int i=0; i<5; i++) {
+
+                        disp=deco[uni];
+                        kuni=1;
+                        wait(0.005);
+                        kuni=0;
+
+                        disp=deco[dec];
+                        kdec=1;
+                        wait(0.005);
+                        kdec=0;
+
+                        disp=deco[cen];
+                        kcen=1;
+                        wait(0.005);
+                        kcen=0;
+
+                        disp=deco[unim];
+                        kunim=1;
+                        wait(0.005);
+                        kunim=0;
+                    }
+                }
+            }
+        }
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/VisDinam.h	Sat Aug 20 14:15:52 2016 +0000
@@ -0,0 +1,28 @@
+#ifndef VisDinam
+#define VisDinam_h
+#include "mbed.h"
+
+class visdi
+{
+
+public:
+
+    void configout(PinName a,PinName b,PinName c,PinName d,PinName e,PinName f,PinName g, PinName kuni, PinName kdec,PinName kcen,PinName kunim);
+    void vis();
+
+private:
+
+    PinName _a;
+    PinName _b;
+    PinName _c;
+    PinName _d;
+    PinName _e;
+    PinName _f;
+    PinName _g;
+    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 14:15:52 2016 +0000
@@ -0,0 +1,13 @@
+#include "VisDinam.h"
+
+int main()
+{
+    visdi lab3;
+    lab3.configout(D2,D3,D4,D5,D6,D7,D8,D12,D13,D14,D15);
+
+    while(1) {
+
+        lab3.vis();
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Aug 20 14:15:52 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/b0220dba8be7
\ No newline at end of file