Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of RawSerial_ex_2 by
Diff: main.cpp
- Revision:
- 0:3b040f367dd8
- Child:
- 2:4ab47f33a1ae
diff -r 000000000000 -r 3b040f367dd8 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Thu Jan 19 14:24:04 2017 -0600
@@ -0,0 +1,21 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+Serial pc(USBTX, USBRX);
+
+void callback_ex() {
+ // 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_ex);
+
+ while (1) {
+ led1 = !led1;
+ wait(0.5);
+ }
+}
