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.
Revision 0:3a7d1a0a9b0b, committed 2017-11-10
- Comitter:
- AnnaBridge
- Date:
- Fri Nov 10 16:03:09 2017 +0000
- Commit message:
- Additional example for UARTSerial
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 |
diff -r 000000000000 -r 3a7d1a0a9b0b main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Fri Nov 10 16:03:09 2017 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+DigitalOut led1(LED1);
+DigitalOut led2(LED2);
+
+UARTSerial pc(USBTX, USBRX);
+
+void callback_ex() {
+ while (1) {
+ char c;
+ if (pc.read(&c, 1) != 1) {
+ break;
+ }
+ printf("%c\n", c);
+ led2 = !led2;
+ }
+}
+
+int main() {
+ pc.set_blocking(false);
+ pc.sigio(mbed::mbed_event_queue()->event(callback_ex));
+
+ while (1) {
+ led1 = !led1;
+ wait(0.5);
+ }
+}
+
diff -r 000000000000 -r 3a7d1a0a9b0b mbed-os.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed-os.lib Fri Nov 10 16:03:09 2017 +0000 @@ -0,0 +1,1 @@ +https://github.com/ARMmbed/mbed-os/#78474a5129e18e136cc7e872adbaa5b74fbb8f6a