Hi!
The full api for Serial can be found @ http://mbed.co.uk/projects/libraries/api/mbed/trunk/Serial (or now directly within the compiler by clicking on the library!), but looking at what it documents, i've realised there is no example :(
The important bit of information which may not be obvious is that these are all "methods"; functions that operate on a C++ object (in this case, a "Serial" object called "pc"). So, you just do something like:
#include "mbed.h"
Serial pc(USBTX, USBRX);
int main() {
pc.baud(19200);
pc.printf("Hello World!");
while(1) {
pc.putc(pc.getc());
}
}
The other important thing to remember is that what it is talking to (e.g. Teraterm on your PC) needs to be setup at the same baud rate, else you'll get garbage!
Hope this gets you going!
Simon
In the following example program, how do we change the baudrate to 19200 (for example).
#include "mbed.h"
Serial pc(USBTX, USBRX);
// baud(19200) <== to be formatted correctly
int main() {
pc.printf("Hello World!");
while(1) {
pc.putc(pc.getc());
}
}