Christian Weiß / Mbed 2 deprecated TINF_Interrupt_Umschalt

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Wizo
Date:
Thu Nov 15 18:07:45 2018 +0000
Commit message:
TINF_Interrupt_Umschalt

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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 15 18:07:45 2018 +0000
@@ -0,0 +1,54 @@
+//TINF_Interrupt
+
+#include "mbed.h"
+
+#define UP 1
+#define DOWN 2
+#define STOP 0
+
+InterruptIn iiCenter(p14);
+InterruptIn iiDown(p12);
+InterruptIn iiUp(p15);
+InterruptIn iiLeft(p13);
+InterruptIn iiRight(p16);
+BusOut doLeds(LED1,LED2,LED3,LED4);
+
+float delay = 0.5;   
+char countDown = STOP;
+
+void swOff() {
+    doLeds = 0; 
+    countDown = STOP;    
+}
+void slow() {
+    delay = 0.5;       
+}
+void fast() {
+    delay = 0.25;   
+}
+void cUp() {
+    countDown = UP;    
+}
+void cDown() {
+    countDown = DOWN;    
+}
+
+int main()
+{
+    doLeds = 0;
+    iiCenter.rise(&swOff);
+    iiLeft.rise(&slow);
+    iiRight.fall(&fast);
+    iiDown.rise(&cDown);
+    iiUp.rise(&cUp);
+    
+    while(1) {
+        if (countDown == DOWN)
+            doLeds = doLeds -1;
+        else if (countDown == UP)
+            doLeds = doLeds +1;
+    
+        wait(delay);
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 15 18:07:45 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/7130f322cb7e
\ No newline at end of file