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.
Dependents: CC1200-MorseEncoder AccurateWaiter-Test
You are viewing an older revision! See the latest version
Homepage
SerialStream adapts an MBed 6.0 serial port class into a Stream instance. This lets you do two useful things with it:
- Call printf() and scanf() on it
- Pass it to code that expects a Stream to print things on. This should help adapt code written for older versions of MBed with a minimum of pain.
Example code:
Hello world program with SerialStream
#include <mbed.h> #include "SerialStream.h" BufferedSerial serial(USBTX, USBRX, 115200); SerialStream<BufferedSerial> pc(serial); int main() { while(true) { pc.printf("Hello world!\n"); ThisThread::sleep_for(1000); } }