I wanted to post about a cool library I found that I think solves a common problem in IoT. Every sensor reading represents an underlying physical value expressed in some sort of units. Many times you need to convert between units based on settings or to be compatible with other portions of code that expect certain units (eg: calculations, etc).
I’m sure this problem has been solved a bunch of different ways. It’s amazing that only recently this has been the target of a serious contender for inclusion in the C++ standard library (C++23/26 sadly…).
The library linked to above is unfortunately not accessible to Mbed as it stands right now. It has some external dependencies (that are also being considered for inclusion in the C++ standard library) and relies on features of C++20. Since Mbed is only on C++14, it’s not simple to use this library.
I found another, comparable library and made a branch that adds files for Mbed build support:
Interested to know if anyone has encountered other useful units libraries