3 years, 3 months ago.

function usage in the common folder in mbed library

Hi Andrea,

/media/uploads/ljiask/functions_in_common_source_file.jpg

May I ask you about how to use functions in the c/c++ files in the common folder in mbed library? I have compiled my code and looks like having errors. I have a few questions below:

1, in my example, I'm using BusOut::write(), BusOut::write(), BusIn::read() etc functions, it looks like I do NOT need to re-declare before my Main program. right? but if not declared, it still shows the message : "Error: A nonstatic member reference must be relative to a specific object in "main.cpp", Line: 68, Col: 6". How to correctly use the functions from the common folder in the library? and I'm wondering if I did something wrong.

2, not sure why the Help in the error numbers return 404 Page Not found.

Thank you,

Daniel L

Daniel,

Thanks for your question.

You're syntax for calling the member function are incorrect, you should be calling BusOut.write ().

Look at:

http://www.tutorialspoint.com/cplusplus/cpp_class_member_functions.htm

Regards,

Andrea, team mbed

posted by Andrea Corrado 18 Aug 2016

Thanks Andrea, I'll look at it. Cheers, Daniel Liu

posted by Daniel Liu 18 Aug 2016

1 Answer

3 years, 3 months ago.

Hi Daniel,

You may find the documentation page and example program located here helpful: https://docs.mbed.com/docs/mbed-os-api-reference/en/5.1/APIs/io/BusOut/

Hope that helps!

-Brian

Accepted Answer