interrupt

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
marcRonquillo
Date:
Thu Oct 22 13:32:42 2015 +0000
Commit message:
interrupt

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 e24676e8e06c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Oct 22 13:32:42 2015 +0000
@@ -0,0 +1,66 @@
+#include "mbed.h"
+
+InterruptIn in1(p17);
+InterruptIn in2(p18);
+
+DigitalOut out1(p21);
+DigitalOut out2(p22);
+
+int count1;
+int count2;
+
+void risingEdge1()
+{
+    count1++;
+    
+    if(count1==3){
+        count1=0;
+        out1=0;
+    }
+    else{
+        out1=1;
+    }
+    
+}
+
+void fallingEdge1()
+{
+    out1=0;
+}
+
+void risingEdge2()
+{
+   count2++;
+    
+    if(count2==4){
+        count2=0;
+        out2=0;
+    }
+    else{
+        out2=1;
+    }
+    
+}
+
+void fallingEdge2()
+{
+    out2=0;
+}
+
+int main() {
+    
+    out1=0;
+    out2=0;
+    
+    count1=0;
+    count2=0;
+    
+    in1.rise(&risingEdge1);
+    in1.fall(&fallingEdge1);
+    in2.rise(&risingEdge2);
+    in2.fall(&fallingEdge2);
+    
+    while(1) {
+       
+    }
+}
diff -r 000000000000 -r e24676e8e06c mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Oct 22 13:32:42 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ba1f97679dad
\ No newline at end of file