LPC1768 with mbed (2) and RawSerial test

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
tbotsQ
Date:
Mon Jan 23 09:45:15 2017 +0000
Commit message:
Echo Test

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 3a22a1cf02f6 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Jan 23 09:45:15 2017 +0000
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+RawSerial pc(USBTX, USBRX);
+
+void callback() {
+    // Note: you need to actually read from the serial to clear the RX interrupt
+    printf("%c\n", pc.getc());
+    led2 = !led2;
+}
+
+int main() {
+    pc.attach(&callback);
+
+    while (1) {
+        led1 = !led1;
+        wait(0.5);
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 3a22a1cf02f6 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Jan 23 09:45:15 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/ad3be0349dc5
\ No newline at end of file