 
   Serial.print(voltage);
   Serial.println (" V");
+  digitalWrite(activityLED, LOW);
+  elapsedTime = millis() - startTime;
+
+  // Wait until 5sec have passed.
+  delay(abs(5000 - elapsedTime));
 }


// +V from battery is connected to analog pin 0
#define measurePin A0

// *** declare constants
const float ref5V = 5.0;    // reference: 5.0V on measurePin == 1023.0

int sumSamples = 0;         // sum of samples
int cntSamples = 0;         // sample counter
float voltage = 0.0;
long startTime;
long elapsedTime;

void setup()
{
  pinMode(activityLED, OUTPUT);    // An LED to signal activity
  Serial.begin(9600);     // Initialise serial port
}

void loop()
{
  startTime = millis();
  digitalWrite(activityLED, HIGH)
  sumSamples = 0;

  // Add up the pre-defined number of samples for Sample Averaging
