3 years, 2 months ago.

Set baudrate serial port

Did I do something wrong? I downloaded the code, but I'm not transmiting the message.

include the mbed library with this snippet

#include "mbed.h"
#include "mbed.h"


Serial device(p9,p10);


int main() {
    device.baud(115200);
    printf("Hello, faster world!");
}

1 Answer

3 years, 2 months ago.

printf goes to standard out as default (the USB virtual COM port on most boards). If you want to send data to a different port you need to indicate which port to use.

#include "mbed.h"
 
Serial device(p9,p10);
 
int main() {
    device.baud(115200);
    device.printf("Hello, faster world!");
}

Accepted Answer