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:73d7b6a301fd, committed 2009-10-27
- Comitter:
- simon
- Date:
- Tue Oct 27 13:44:37 2009 +0000
- Commit message:
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 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Tue Oct 27 13:44:37 2009 +0000
@@ -0,0 +1,33 @@
+// test example for \n \r, sford
+// serial loop back - wire p9 to p10
+
+#include "mbed.h"
+
+Serial pc(USBTX, USBRX);
+Serial loopback(p9, p10);
+
+// read characters from serial port
+void dump() {
+ wait(0.1); // dumb wait to ensure all chars arrived
+ while(loopback.readable()) { // work through chars
+ char c = loopback.getc();
+ if(c == '\n') {
+ printf("0x%02X LF\n", c);
+ } else if(c == '\r') {
+ printf("0x%02X CR\n", c);
+ } else {
+ printf("0x%02X %c\n", c, c);
+ }
+ }
+}
+
+int main() {
+ loopback.putc('a');
+ dump();
+ loopback.putc('\n');
+ dump();
+ loopback.putc('\r');
+ dump();
+ loopback.printf("hi\n");
+ dump();
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Tue Oct 27 13:44:37 2009 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/a0336ede94ce