ggg

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
hellebrand
Date:
Thu Mar 31 10:13:50 2016 +0000
Commit message:
hm, hm

Changed in this revision

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
diff -r 000000000000 -r 310fa9b8d43e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Mar 31 10:13:50 2016 +0000
@@ -0,0 +1,36 @@
+# include "mbed.h"
+
+DigitalOut pipak (D12);
+DigitalIn Tlac_1 (D10);
+Serial comp(SERIAL_TX, SERIAL_RX);
+
+int main () {
+    comp.baud(9600);
+    float fregvence, perioda, cas;
+    bool cudl, cudl_pred, pipej, smer;
+    fregvence = 1000;
+    while (1) {
+        cudl_pred = cudl;
+        cudl = Tlac_1;
+        perioda = 1 / fregvence;
+        cas = perioda / 2;
+        if((cudl==1)&&(cudl_pred==0)) pipej = !pipej;
+        if(pipej == 1) {
+            for(int i=0;i<(fregvence / 25);i++) {
+                pipak = 1; // LED zapnuta
+                wait (cas) ; // 200 ms
+                pipak = 0; // LED vypnuta
+                wait (cas) ; // 1 sec
+                }
+            if (smer == 1) fregvence = fregvence * 1.1;
+            if (smer == 0) fregvence = fregvence / 1.1;
+            if (fregvence > 6000) smer = 0;
+            if (fregvence < 300) smer = 1;
+            /* comp.printf("cas: %.8f",cas);
+            comp.printf("\t perioda: %.8f",perioda);
+            comp.printf("\t fregvence: %0.1f",fregvence);
+            comp.printf("\n\r");
+            */
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 310fa9b8d43e mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Mar 31 10:13:50 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/c0f6e94411f5
\ No newline at end of file