Hi Freddie,
Yep, that's right. The printf() goes to "stdout", which is the mbed USB serial port (UART0 on the LPC1768, which is read by the mbed interface and converted to USB).
Using printf called on an object means it can easily be replaced by other objects. For example, if you had:
Serial output(USBTX, USBRX);
:
output.printf("Hello ");
output.printf("World!\n");
you could easily change it to put puting on an LCD without changing any of the code using it:
TextLCD output(...pins...); // just chance what object "output" is
:
output.printf("Hello ");
output.printf("World!\n");
As you say, having the object gives you control over the aspects of the object, so in the case of a Serial port, that is things like baud rate. So printf() is great for debugging, whilst object.printf() is more useful/used when it is explicitly part of your application.
Simon
Wher does printf() get directed to by default? Like for instance in this program....