ramdeoshubham/macros

Constrain macro

Closed this issue · 2 comments

The arduino library has a constrain macro which I find quite useful. Perhaps a nice addition?

#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt)))

Of course !
Can you make a pull request in the macros.h at the end of the file, so that we can acknowledge you as a contributor 😄 ?
Thanks !

Ohkay I added it myself. Thanks for your suggestion.
d402c30