fork
Fork of RawSerial_ex_2 by
Revision 0:3b040f367dd8, committed 2017-01-19
- Comitter:
- mab5449
- Date:
- Thu Jan 19 14:24:04 2017 -0600
- Child:
- 1:300362127299
- Commit message:
- Initial commit. Ported code snippets to mbed OS 5 projects
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed-os.lib | 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 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);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Thu Jan 19 14:24:04 2017 -0600 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#34c1facf42a174f47fdf9002cd8c6bf10ac41744
