   }
   Serial.println();
   
+}
+
+/*
+ * ISR for pin 2 (int.0)
+ */
+void isrMotion() {
+  // Tell the loop to power up the ping sensors.
+  pingPowerState = 1;
+  // Rest the awake time.
+  awakeTime = 0;
 }
 
 void setup() 

const byte PIN_TRIG_RIGHT = 5;  // Send the ping on the right sensor.
const byte PIN_ECHO_RIGHT = 6;  // Listen for the right ping's echo.

byte pingPowerState = 1;        // 0 = sensor off, 1 = sensor on.
 
unsigned long msgId = 0;        // Each transmission has an id so the receiver knows if it missed something.
unsigned long lastTransmit = 0; // The last time a transmission was sent.
 
unsigned long pingTimer[SONAR_NUM]; // Holds the times when the next ping should happen for each sensor.
unsigned int cm[SONAR_NUM];         // Where the ping distances are stored.

 then turn on the two ping sensors which detect if someone goes past and in which direction.

*/

// http://www.nongnu.org/avr-libc/user-manual/group__avr__power.html
#include <avr/power.h>
#include <avr/sleep.h>

// NewPing uses timer 2 and switches pinging between sensors
// @see https://code.google.com/p/arduino-new-ping/
