     digitalWrite(PIN_DEBUG_MOTION, HIGH);   
   }
   
-  if (pingPowerState == 0) {
+  if (powerState == 0) {
     // Turn off the power to the ping sensors.
     digitalWrite(PIN_PING_POWER, LOW);
     // Turn off the rf power.

{
  Serial.begin(115200);
  
  bitClear(flags, F_MOTION);
  bitClear(flags, F_LEFT);
  bitClear(flags, F_RIGHT);
  
  pinMode(PIN_PIR, INPUT);
  

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.


// Debug leds
const byte PIN_DEBUG_MOTION = 13; // The PIR detected motion.
 
const byte RF_ID = 1;           // The unique id of this device, so the receive knows where it came from.

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.

