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 mbed-rtos 4DGL-uLCD-SE HC_SR04_Ultrasonic_Library
Diff: main.cpp
- Revision:
- 24:fd113f826c98
- Parent:
- 23:f877b13f22b7
- Child:
- 25:577a78b97309
diff -r f877b13f22b7 -r fd113f826c98 main.cpp
--- a/main.cpp Sun Apr 26 21:15:38 2020 +0000
+++ b/main.cpp Mon Apr 27 21:58:28 2020 +0000
@@ -74,17 +74,17 @@
{
++non_zeros; //Incriment non_zero counter
//allZero = false;
- if(non_zeros > 1) //If there is more than one non zero
+ if(non_zeros > 2) //If there is more than one non zero
{
allZero = false; //Change the allZero flag to false
}
}
//NEW CODE
- if(values[i] < values[(i+1)%5] && values[(i+1)%5] < values[(i+2)%5])
+ if(values[i] < values[(i+1)%5] && values[(i+1)%5] < values[(i+2)%5] && values[i] !=0)
{
movingAway = true; //Person moving away from sensor
}
- if (values[i] > values[(i+1)%5] && values[(i+1)%5] > values[(i+2)%5])
+ if (values[i] > values[(i+1)%5] && values[(i+1)%5] > values[(i+2)%5] && values[(i+2)%5] !=0)
{
movingTowards = true; //Person moving to the sensor
}