5 years, 9 months ago.

Im having a problem using the mbed API EventFlags part, it gives an error on the online compiler.

The thing is that the online compiler states that the declaration of the object is undentified.

This is the code that is on the API reference example:

  1. include "mbed.h"

EventFlags event;

void worker_f() { while (true) { event.wait_all(0x1);

printf("Got signal!\r\n"); } }

int main() { Thread worker;

worker.start(callback(worker_f));

while (true) { wait(1); event.set(0x1); } }

3 Answers

5 years, 9 months ago.

Hello Jose,

Which mbed library are you using? I believe you need to use the mbed 5 library in order for the code to compile:

https://github.com/ARMmbed/mbed-os

I was able to successfully compile the code using the mbed-os library. Hope this helps!

-Karen, team Mbed

If this solved your question, please make sure to click the "Thanks" link below!

5 years, 9 months ago.

Are you sure you are using mbed-os5 and not just mbed-os2 ? tried your code under mbed-os5 OK using F401RE

Regards

5 years, 9 months ago.

Hi, I think, you need the mbed-os library instead of the mbed library for work with events.