Arm Mbed OS support forum

Header class error online compiler F411RE "Expected ')' ..... "

Hi everybody,

I’m using a HC SR04 ultrasonic sensor and a Nucleo F411RE for my current school project and I decided to use a library for the sensor to simplify things. The library I used was the one from EJ Teb:

https://os.mbed.com/users/ejteb/code/HC_SR04_Ultrasonic_Library/

But I have an issue with the classes in the .h file (I have the same issue in other self-made library’s within my project). When I try to build the code (I use the Mbed online compiler) the compiler gives me an error back saying it expects a ) after the first PinName, see below.

class ultrasonic
{
public:
/iniates the class with the specified trigger pin, echo pin, update speed and timeout/
class ultrasonic (PinName trigPin, PinName echoPin, float updateSpeed, float timeout);
//Error: Expected ‘)’ in “HC_SR04_Ultrasoon/HC_SR04_Ultrasoon.h”, Line: 13, Col: 35
// Other code after this

Can somebody please help me figure out what I’m doing wrong?

Hello,

I tried it in original state (only mbed lib update to latest) and no compilation error. So you probably somewhere deleted end of parenthesis “)”.

Also I played with this sensor because of this topic.

BR, Jan

Thank you for leaving a comment on my problem,

I updated the Mbed-os and copied over your library’s and it seems to have fixed itself. I still don’t know what the exact issue was but the library’s work now. And as always a new issue popped up, now my USB serial communication to my laptop doesn’t work but that should be easy to fix.

A big thanks again for your help,
Mitchel