 {
   Serial.begin(115200);
   
-  bitClear(flags, F_MOTION);
-  bitClear(flags, F_LEFT);
-  bitClear(flags, F_RIGHT);
+  // Zero all the flags.
+  flags = 0;
   
   pinMode(PIN_PIR, INPUT);
   

  // The motion ISR sets a flag so we know it detected motion.
  if (bitRead(flags, F_MOTION)) {
    bitClear(flags, F_MOTION);
    if (pingPowerState == 0) {
      // Remember when the cpu woke up.
      awakeTime = millis();
    }
    
    // Ensure the ping sensors are powered.
    pingPowerState = 1;
    // Turn on the ping power.
    digitalWrite(PIN_PING_POWER, HIGH);
    // Turn on the rf power.

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.

