Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Wizo
Date:
Thu Nov 15 18:10:21 2018 +0000
Commit message:
TINF_Test2

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 39df3b292863 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 15 18:10:21 2018 +0000
@@ -0,0 +1,85 @@
+#include "mbed.h"
+
+
+int zaehler = 7;
+
+InterruptIn JsUp(p15);
+InterruptIn JsDown(p12);
+InterruptIn JsLeft(p13);
+InterruptIn JsRight(p16);
+InterruptIn JsCenter(p14);
+BusOut myLed(LED1, LED2, LED3, LED4);
+
+void plus1()
+{
+    if(zaehler <= 30)
+    zaehler += 1;
+    
+    wait(0.25);
+}
+void plus5()
+{
+    if(zaehler <= 30)
+    zaehler += 5;
+    
+    wait(0.25);
+}
+void minus1()
+{
+    if(zaehler >= -20)
+    zaehler -= 1;
+    
+    wait(0.25);
+}
+void minus5()
+{
+    if(zaehler >= -20)
+    zaehler -= 5;
+    
+    wait(0.25);
+}
+void Zaehlerstand()
+{
+    printf("Zaehlerstand = %d\n", zaehler);
+    wait(0.25);
+}
+int main() {
+    
+    JsUp.rise(&plus1);
+    JsDown.rise(&plus5);
+    JsLeft.fall(&minus1);
+    JsRight.fall(&minus5);
+    
+    JsCenter.rise(&Zaehlerstand);
+    
+    printf("BULME: Joystick-Zaehler ++++++ 29.01.2018 ++++++ Christian Weiss\n");
+
+    
+    
+    while(1) 
+    {
+        if(zaehler <= 30 && zaehler >= -20) 
+        {
+            myLed = 6;
+        }
+        else if(zaehler > 30)
+        {
+            myLed = 12;
+            wait(0.2);
+            myLed = 0;
+            wait(0.2);
+        }
+        else if(zaehler < -20)
+        {
+            myLed = 3;
+            wait(0.5);
+            myLed = 0;
+            wait(0.5);
+        }
+        
+
+    }
+}
+
+
+
diff -r 000000000000 -r 39df3b292863 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 15 18:10:21 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file