     LLAP.sendInt("ERR",val); // Diagnostic
     delay(5000);	// try again in 5 seconds
   }
-  for(int i=0;i<3;i++) {
+
+  // Repeat "STARTED" message 5 times to alert
+  for(int i=0;i<5;i++) {
     LLAP.sendMessage("STARTED");
-  }
-
-
-
-    // Initial Distance reading
+    delay(1000);
+  }
+
+}
+
+// The main loop, we basically wake up the SRF, take a reading, transmit reading then go back to sleep
+void loop() {
+
+  // Determine if we need to send a battery voltage reading or a distance reading
+  if( --batteryCountDown <= 0 ) {
+    int mV = readVcc();
+    LLAP.sendIntWithDP("B", mV, 3 );
+    batteryCountDown = BATTERY_READ_INTERVAL;
+  } 
+  else {
+
+    // Distance reading
     uint16_t cm = getRange();
     // Send temperature reading
     if( tempSensorFound ) {

  nodeId[1] = '0' + min(digit2,9);
  pollingInterval = ((PINB & 0x06) >> 1) ^ 0x03;

  Serial.println(PINB,HEX);
  Serial.println(PINC,HEX);
  
  Serial.println(pollingInterval,DEC);

  Serial.println(digit1,DEC);
  Serial.println(digit2,DEC);
  // A0, A1 are first part, R, S, T, W
  // A2 - A5 are 0-9, A-F

        LLAP.sendMessage( "UErr" );
      }
    }
  }

  // Short delay to allow reading to be sent then sleep
  delay(50);
  pinMode(SRF_SLEEP, INPUT);                // sleep the radio
  LLAP.sleep(WAKE_INT, RISING, false);      // sleep until woken on pin 2, no pullup (low power)
  pinMode(SRF_SLEEP, OUTPUT);               // wake the radio

}
// That's all folks

