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.
Revision 0:1c941e8eb861, committed 2013-06-16
- Comitter:
- robt
- Date:
- Sun Jun 16 15:18:39 2013 +0000
- Commit message:
- by Rob Toulson and Tim Wilmshurst from textbook "Fast and Effective Embedded Systems Design: Applying the ARM mbed"
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| mbed.bld | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sun Jun 16 15:18:39 2013 +0000
@@ -0,0 +1,20 @@
+/*Program Example 11.2 Low pass filter function
+ */
+float LPF(float LPF_in){
+
+ float a[4]={1,2.6235518066,-2.3146825811,0.6855359773};
+ float b[4]={0.0006993496,0.0020980489,0.0020980489,0.0006993496};
+ static float LPF_out;
+ static float x[4], y[4];
+
+ x[3] = x[2]; x[2] = x[1]; x[1] = x[0]; //move x values by one sample
+ y[3] = y[2]; y[2] = y[1]; y[1] = y[0]; //move y values by one sample
+
+ x[0] = LPF_in; // new value for x[0]
+ y[0] = (b[0]*x[0]) + (b[1]*x[1]) + (b[2]*x[2]) + (b[3]*x[3])
+ + (a[1]*y[1]) + (a[2]*y[2]) + (a[3]*y[3]);
+
+ LPF_out = y[0];
+ return LPF_out; // output filtered value
+}
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sun Jun 16 15:18:39 2013 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/b3110cd2dd17 \ No newline at end of file