Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed ros_lib_kinetic
utilities.cpp
00001 00002 #include "utilities.h" 00003 #include "mbed.h" 00004 00005 namespace utils { 00006 00007 float smooth(float data, float filterVal, float smoothedVal) { 00008 00009 if (filterVal > 1) { // check to make sure param's are within range 00010 filterVal = .99; 00011 } else if (filterVal <= 0) { 00012 filterVal = 0; 00013 } 00014 00015 smoothedVal = (data * (1 - filterVal)) + (smoothedVal * filterVal); 00016 00017 return (float)smoothedVal; 00018 } 00019 00020 float min(float a, float b) { 00021 if (a < b) 00022 return a; 00023 else 00024 return b; 00025 } 00026 00027 void printBits(char myByte, Serial &pc) { 00028 for (char mask = 0x80; mask; mask >>= 1) { 00029 if(mask & myByte) 00030 pc.putc('1'); 00031 else 00032 pc.putc('0'); 00033 } 00034 } 00035 00036 } // end utils namespace
Generated on Tue Jul 12 2022 21:35:43 by
