Simon Ford
/
SerialBuffer
Simple example of reading a single character and a series of characters in to a buffer from a serial port
Revision 0:dc609501b657, committed 2012-06-10
- Comitter:
- simon
- Date:
- Sun Jun 10 07:53:43 2012 +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 |
diff -r 000000000000 -r dc609501b657 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun Jun 10 07:53:43 2012 +0000 @@ -0,0 +1,15 @@ +#include "mbed.h" + +DigitalOut myled(LED1); +Serial pc(USBTX, USBRX); + +int main() { + char c; + char buffer[128]; + + c = pc.getc(); + + pc.gets(buffer, 4); + + pc.printf("I got '%c' and '%s'\n", c, buffer); +}
diff -r 000000000000 -r dc609501b657 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jun 10 07:53:43 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/737756e0b479