ver1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
mirzamesic
Date:
Mon Dec 16 18:29:12 2019 +0000
Commit message:
Interrupt aufgabe

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	Mon Dec 16 18:29:12 2019 +0000
@@ -0,0 +1,58 @@
+#include "mbed.h"
+#define BUTTON1 p14     // push joystick pin
+#define BUTTON2 p12     // push joystick pin down 
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);  
+
+
+InterruptIn button(BUTTON1);
+InterruptIn button1(BUTTON2);
+
+Ticker t1;
+float zeit = 0.2;
+uint8_t counter = 0;
+
+
+void blink_led1()
+{
+    led1 = !led1;
+}
+
+void toggle()
+{
+   zeit=0.1;
+}
+void toggle1()
+{
+    zeit=0.2;
+}
+
+void druckanzahl(){
+    
+    counter++;
+    if(counter==10){    
+      led2=1;  
+      counter=0; 
+    }
+    else 
+    led2=0;
+    }
+
+
+
+
+int main()
+{
+
+    button.rise(&toggle);
+    button.fall(&toggle1);
+    button1.rise(&druckanzahl);
+    while(1) {
+
+        blink_led1();
+        wait(zeit);
+
+
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Dec 16 18:29:12 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file