Sz_Insper / Mbed 2 deprecated Null_Kreuzung

Dependencies:   mbed

Revision:
0:0faa3d26e55e
Child:
1:6192e5b45a58
diff -r 000000000000 -r 0faa3d26e55e main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Wed Sep 16 13:06:09 2020 +0000
@@ -0,0 +1,49 @@
+# include "mbed.h"
+
+AnalogIn pot(A0);
+InterruptIn Pulso(D7);
+DigitalOut scr   (D8);
+Serial pc(USBTX,USBRX);
+
+
+int temp = 0;
+float analog ;
+int angle = 0;
+
+
+void interrupt ()
+{
+    for (int i = 0; i<temp; i++) {
+
+
+        scr = 1;
+        wait_us(temp);
+        scr = 0;
+        //wait(1);
+
+
+    }
+
+}
+
+
+
+int main()
+{
+
+    Pulso.rise(&interrupt);
+
+    while(1) {
+
+        analog = pot;
+
+
+        temp = (analog*45); // angulo
+        pc.printf("\n\r%1.3f ",analog);
+        wait(0.5);
+        temp =0;
+
+
+    }
+
+}