extra test

Dependencies:   DHT

Files at this revision

API Documentation at this revision

Comitter:
elt14lpo
Date:
Thu May 11 09:56:30 2017 +0000
Parent:
3:0beeffb8a329
Commit message:
wider micDist;

Changed in this revision

newdemo.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/newdemo.cpp	Thu May 11 08:36:02 2017 +0000
+++ b/newdemo.cpp	Thu May 11 09:56:30 2017 +0000
@@ -32,13 +32,13 @@
 
 //----------VARIABLES HERE
 int dataLength = 1000;
-int captureLength = 25;
+int captureLength = 50;
 double temp = 22;
 double hum = 10;
-double micDist = 0.150; //meters
+double micDist = 0.250; //meters
 double threshold_1 = 0; //value when going to active mode channel 1  //old hardcoded value = 330
 double threshold_2 = 0; //value when going to active mode channel 2 //old hardcoded value = 200
-double threshold_adjust = 300;  //used to adjust threshold, + for less sensitivity, - for increased sensitivity
+double threshold_adjust = 15;  //used to adjust threshold, + for less sensitivity, - for increased sensitivity
 bool calibratedStatus = false;      //flag to make sure Nuclueo only calibrated once for background noise
 bool checkTemp = false;         //flag - true to checktemp, false to use predefined values
 int positionOfMaxVal_1;
@@ -296,7 +296,7 @@
                 int positionOfMaxVal_2 = FindPeak(2);
                 //run functions
                 double timedelay = FindTimeDelay(positionOfMaxVal_1, positionOfMaxVal_2); //microseceonds
-                if(abs(timedelay) > 435){
+                if(abs(timedelay) > micDist/calcSoundSpeed(temp, hum)){
                     STATE = CALC_ERROR;
                     break;
                 }