5 years, 1 month ago.

Declaration of Serial with baud rate parameter will not compile, but only in some programs

I used the mbed online compiler a few months ago and it was a joy to use, now today it's giving me problems all over the place before I've even got a few lines coded....

I have this exact same line in two programs:

Serial pc(USBTX, USBRX, 9600);

One of the programs compiles fine, and the other says "Error: No instance of constructor mbed::Serial::Serial matches the argument list". Why would that be?

In other news the documentation section of all my programs says simply "Documentation not ready" and doing "Update docs" from under the Compile menu changes nothing.

The online docs for the Serial class (https://os.mbed.com/handbook/Serial) state that the default baud rate is 9600 but this seems not to be true. I get serial output but it's some other baud rate.

I can get around this issue by declaring the class without the baud rate parameter and doing pc.baudrate(9600) in the main function, but I'm puzzled about why this shouldn't just work the same in both programs.

1 Answer

5 years, 1 month ago.

Are you compiling for different mbed platforms? Which one works, which one doesnt? Maybe you need to update the mbed lib. Rightclick on the mbed lib in your program folder, check version and update.

Documentation gives problems in case your header file/class definition doesnt follow the format rules.

Accepted Answer

After right-clicking on the mbed lib and choosing Update I can compile with the baud rate parameter. Thanks!

All of my programs have the problem with "Documentation not ready". All my old programs that were fine before, and even this very simple one below. There is no header file for this one, and I don't know how this could be not following the format rules:

  1. include "mbed.h" Serial pc(USBTX, USBRX, 9600);

int main() { pc.printf("hello"); }

In the main documentation page, in the API section it says "No documentation found" and the 'mbed' link seems to be broken, so it seems there is still something not right... https://os.mbed.com/handbook/Serial (link in API section) https://os.mbed.com/users/mbed_official/code/mbed/docs/tip/classmbed_1_1Serial.html

posted by iforce2d Chris 30 Sep 2019

Sorry, forgot to mention, the platform type makes no difference to any of this. At least for the platforms I've tried.

posted by iforce2d Chris 30 Sep 2019