Bringing MBed serial ports back like it's 1999... or at least 2019.
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); } }