How to fix mbed error: 'wait' was not declared in this scope (PlatformIO)
Problem:
While compiling your mbed / PlatformIO application, you see an error message like
output.txt
src/actuators.cpp:253:5: error: 'wait' was not declared in this scope
253 | wait(1.0);
| ^~~~
Solution
wait is an old API and has been deprecated in favour of the C++ standard ThisThread::sleep_for
. Use
example.cpp
ThisThread::sleep_for(1s);
Check out similar posts by category:
Embedded, Mbed, PlatformIO
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow