People Counter / Mbed 2 deprecated person_counter

Dependencies:   mbed mbed-rtos 4DGL-uLCD-SE HC_SR04_Ultrasonic_Library

Revision:
23:f877b13f22b7
Parent:
22:8f262e8f65b4
Child:
24:fd113f826c98
diff -r 8f262e8f65b4 -r f877b13f22b7 main.cpp
--- a/main.cpp	Sun Apr 26 21:08:58 2020 +0000
+++ b/main.cpp	Sun Apr 26 21:15:38 2020 +0000
@@ -82,11 +82,11 @@
         //NEW CODE
         if(values[i] < values[(i+1)%5] && values[(i+1)%5] < values[(i+2)%5])
         {
-            movingTowards = true;
+            movingAway = true;      //Person moving away from sensor
         }
         if (values[i] > values[(i+1)%5] && values[(i+1)%5] > values[(i+2)%5])
         {
-            movingAway = true;
+            movingTowards = true;   //Person moving to the sensor
         }
         //
     }
@@ -126,7 +126,7 @@
         //uLCD.cls();
         dist.lock();
         //uLCD.filled_rectangle(90,0,128,40,BLACK);
-        sprintf(str1,"%d  ",sdist);
+        sprintf(str1,"%d     ",sdist);
         uLCD.text_string(str1,12,0,FONT_5X7,GREEN);
         sprintf(str1,"%d  ",numTowards);
         uLCD.text_string(str1,12,1,FONT_5X7,GREEN);