pc.printf not working

11 Apr 2012

Hi all,

I'm trying to use the basic "Hello World" program provided to get to grips with debugging to the Terminal (trying on both OS X and Ubuntu)

Hello World!
#include "mbed.h"              

Serial pc(USBTX, USBRX); // tx, rx

int main() {
    pc.printf("Hello World!\n");
}

It goes on to say you need to use the command /dev/tty.usbmodem* (mac) or /dev/tty.ACM* (linux)

However I keep getting the same error on both machines - :command not found. Do I need to do something else before this will work? The handbook doesn't mention anything else?

Probably a really simple question and an even simpler solution, but I'd really appreciate some help!

Thanks, Dan

11 Apr 2012

It's Ok I've figured it out.

Just for reference for anyone else looking, the command you need to run is -

screen /dev/tty.usbmodem*

16 Apr 2012

how about windows7?

18 Apr 2012

http://mbed.org/handbook/SerialPC

Discusses how to discover what serial port the mbed gets mapped to and gives examples of terminal applications you can use.

03 Oct 2018

Daniel Knight wrote:

screen /dev/tty.usbmodem

care to explain how?

03 Oct 2018

Hi Jeffin,

We have a guide for debugging using printf statements here: https://os.mbed.com/docs/v5.10/tutorials/debugging-using-printf-statements.html

Please let me know if you have any questions!

- Jenny, team Mbed