 #define F_MOTION 1 // 1 = activated  0 = no movement
 #define F_LEFT   2 // 1 = detection  0 = no detection
 #define F_RIGHT  3 // 1 = detection  0 = no detection
-
+#define F_ACTIVE_LEFT   4 // 1 = detection  0 = no detection
+#define F_ACTIVE_RIGHT  5 // 1 = detection  0 = no detection
+
+const byte DISTANCE_THRESHOLD = 40; // Less than this (in cm) activates the detection sequence.
 
 // Pins
 const byte PIN_PIR = 2;         // PIR on external interupt to wake up the cpu, int.0 interupt 0 on pin 2


byte flags = 0; // Booleans

volatile byte pingPowerState = 0;     // 0 = ping off, 1 = ping on.
volatile unsigned long awakeTime = 0; // When the cpu woke up.



    // Turn off the debug light.
    digitalWrite(PIN_DEBUG_MOTION, LOW);

    // Zero all the flags.
    flags = 0;
  
    // Sleep until the next motion.
    sleepNow();
  } 
