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.h@5:864709d3eb76, 2018-06-29 (annotated)
- Committer:
- ambyld
- Date:
- Fri Jun 29 17:49:40 2018 +0000
- Revision:
- 5:864709d3eb76
- Parent:
- 1:40bdbe1a93b7
Moved isolated debug scripts to separate header file
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| Knillinux | 0:dd126a1080d3 | 1 | |
| Knillinux | 0:dd126a1080d3 | 2 | #ifndef UTILITIES_H_INCLUDED | 
| Knillinux | 0:dd126a1080d3 | 3 | #define UTILITIES_H_INCLUDED | 
| Knillinux | 0:dd126a1080d3 | 4 | |
| Knillinux | 0:dd126a1080d3 | 5 | #include "mbed.h" | 
| Knillinux | 0:dd126a1080d3 | 6 | |
| Knillinux | 0:dd126a1080d3 | 7 | namespace utils { | 
| Knillinux | 0:dd126a1080d3 | 8 | // From http://playground.arduino.cc/Main/Smooth | 
| Knillinux | 0:dd126a1080d3 | 9 | /*Details: Smooth takes three parameters, the value to smoothed, the filter value (filterVal), and smoothedVal. | 
| Knillinux | 0:dd126a1080d3 | 10 | |
| Knillinux | 0:dd126a1080d3 | 11 | float sensVal - the sensor variable - raw material to be smoothed | 
| Knillinux | 0:dd126a1080d3 | 12 | |
| Knillinux | 0:dd126a1080d3 | 13 | float filterVal - The filter value is a float and must be between 0 and .9999 say. 0 is off (no smoothing) and .9999 is maximum smoothing. | 
| Knillinux | 0:dd126a1080d3 | 14 | The actual performance of the filter is going to be dependent on fast you are sampling your sensor (the total loop time), so | 
| Knillinux | 0:dd126a1080d3 | 15 | some trial and error will probably be necessary to get the desired response. | 
| Knillinux | 0:dd126a1080d3 | 16 | |
| Knillinux | 0:dd126a1080d3 | 17 | smoothedVal - Use this for the output of the sensor and also feed it back into the loop. Each sensor needs its own value. | 
| Knillinux | 0:dd126a1080d3 | 18 | Don't use this variable for any other purpose.*/ | 
| Knillinux | 0:dd126a1080d3 | 19 | float smooth(float data, float filterVal, float smoothedVal); | 
| Knillinux | 1:40bdbe1a93b7 | 20 | |
| Knillinux | 1:40bdbe1a93b7 | 21 | float min(float a, float b); | 
| ambyld | 5:864709d3eb76 | 22 | |
| ambyld | 5:864709d3eb76 | 23 | void printBits(char myByte, Serial &pc); | 
| Knillinux | 0:dd126a1080d3 | 24 | } // end utils namespace | 
| Knillinux | 0:dd126a1080d3 | 25 | |
| Knillinux | 0:dd126a1080d3 | 26 | |
| Knillinux | 0:dd126a1080d3 | 27 | #endif // End include guard |