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.
Diff: sensors/sensors.cpp
- Revision:
- 25:c740e6fd5dab
- Parent:
- 22:0ed9de464f40
- Child:
- 26:5fb1aa9cb7f0
--- a/sensors/sensors.cpp Fri May 03 10:00:20 2019 +0000
+++ b/sensors/sensors.cpp Mon May 06 04:03:00 2019 +0000
@@ -1,7 +1,7 @@
#include "sensors.h"
#include "microinfinity.h"
#include "pinnames.h"
-const float kOldWeight = 0.5;
+const float kOldWeight = 0;
const float kOldWeightLight = 0.3; //filterの重み.軽いver
const float kOutVal = 500; //<0.1が返ってきたときに返す値
@@ -44,16 +44,18 @@
}
float GetFilteredDist_cm(HCSR04 & sensor, LowPassFilter & filter)
{
- wait_ms(60);
+ wait_ms(30);//60
sensor.start();
wait_ms(30);
float raw_data = sensor.get_dist_cm();
if(raw_data < 20)//0.1以下なら前回の値を返す
return kOutVal;
- filter.SetData(raw_data);
+/* filter.SetData(raw_data);
float dist = filter.GetData();
// printf("raw %.3f, filter %.3f\r\n", raw_data,dist);
return dist;
+ */
+ return raw_data;
}
float get_dist_forward()