serial comm example

Dependencies:   PinDetect mbed

Files at this revision

API Documentation at this revision

Comitter:
mohammmo
Date:
Sat Feb 01 23:51:06 2014 +0000
Child:
1:dd2f972ef479
Commit message:
Hi Oliver, I'm trying the commit

Changed in this revision

PinDetect.lib Show annotated file Show diff for this revision Revisions of this file
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/PinDetect.lib	Sat Feb 01 23:51:06 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/AjK/code/PinDetect/#cb3afc45028b
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Feb 01 23:51:06 2014 +0000
@@ -0,0 +1,33 @@
+#include "mbed.h"
+#include "PinDetect.h"
+
+DigitalOut myled(PTD5);
+DigitalOut myled1(PTE29);
+
+//DigitalIn enable(PTC3);
+//InterruptIn button(PTC3);
+PinDetect button(PTC3);
+Serial pc(USBTX,USBRX);
+
+void flip(){
+    myled = !myled;
+    myled1= !myled1;
+    pc.puts("look at me bitch\r\n");
+}
+
+int main() {
+    //setup LED with debounce
+    myled = 1;
+    myled1 = 0;
+    button.mode(PullUp);
+    wait(.001);
+    button.attach_deasserted(&flip);
+    button.setSampleFrequency();
+    
+    char buffer[128];
+    
+    while(1) {
+        pc.gets(buffer,4);
+        pc.printf("i got '%s'\r\n",buffer);        
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sat Feb 01 23:51:06 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/824293ae5e43
\ No newline at end of file