Button_runlight_Interrupt

Dependencies:   mbed

Revision:
0:bf64b77eb9c9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 13 03:38:59 2020 +0000
@@ -0,0 +1,45 @@
+#include "mbed.h"
+
+    //      D20,D19,D18,D17,...
+BusOut lb(P1_13,P1_12,P1_7,P1_6,P1_4,P1_3,P1_1,P1_0,LED4,LED3,LED2,LED1);
+
+    // Sw4 als Interrupt definieren
+InterruptIn sw4(P1_16);
+
+
+void OneRunLightStep2();
+
+void ButtonISR()
+{   
+    if(sw4.read()==1)
+    OneRunLightStep2();
+}
+
+int main()
+
+{   
+    sw4.rise(ButtonISR);
+    while(1)
+    {
+    }
+  
+}
+
+
+void OneRunLightStep2()
+{
+    if(lb==0)
+    lb=1;
+    else
+    lb=lb<<1;   // Finster
+}
+
+        
+        
+    
+    
+    
+    
+    
+
+