first lib
Dependents: 17robo_fuzi 17robo_tokyo_kaede
Diff: limit.cpp
- Revision:
- 0:9665aacf40f0
diff -r 000000000000 -r 9665aacf40f0 limit.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/limit.cpp Sun Sep 24 05:24:56 2017 +0000 @@ -0,0 +1,21 @@ + +#include "limit.h" +#include "mbed.h" + +int limiti(int data, int max, int min){ + if (data > max) { + return max; + } else if (data < min) { + return min; + } + return data; +} + +float limitf(float data, float max, float min){ + if (data > max) { + return max; + } else if (data < min) { + return min; + } + return data; +} \ No newline at end of file