12 years, 6 months ago.

Compiling "Serial_Hello World_mbed

I just posted a question about why the the above program would not compile. It compiled now. I'm not sure why, but I think I may have had two compilers loaded at the same time on two different tabs.

How do I enter data and have it echo'ed? Do I need to get the terminal loaded first? I suppose maybe this is obvious to most, but I am very new to this.

Tom

1 Answer

12 years, 6 months ago.

Look into the following for debugging:

int main( ... )
{
  int aVar = 10;
  Serial pc(USBTX, USBRX); // tx, rx
  pc.printf( "Hello world! %d\n\r", aVar );
}

You'll need some sort of terminal emulation software - tterm on Windows, likely; Terminal/cu on Mac; an Xterm/cu on Linux - to connect to the mbed's serial port. On my mac, I use the following, within the Terminal app:

sudo cu -l cu.usbmodemfa1332 -s 9600

If I hit the reset button on the mbed, I'd see, "Hello world! 10" in the Terminal output.

Check the settings for tterm for Windows.

Accepted Answer