   //processor and the alarm flag is set. Clear the flag and
   //handle whatever we need to do.
   else {
+    
+     /*get voltage*/
+    // take a number of analog samples and add them up
+    while (sample_count < NUM_SAMPLES) {
+        sum += analogRead(A3);
+        sample_count++;
+        delay(10);
+    }
+    // calculate the voltage
+    // use 5.0 for a 5.0V ADC reference voltage
+    // 5.015V is the calibrated reference voltage
+    voltage = ((float)sum / (float)NUM_SAMPLES * 5.05) / 1024.0;
+    // send voltage for display on Serial Monitor
+    // voltage multiplied by 11 when using voltage divider that
+    // divides by 11. 11.132 is the calibrated voltage divide
+    // value
+#if DEBUG
+    Serial.print(voltage * 11.133);
+    Serial.println (" V");
+#endif    
+    sample_count = 0;
+    sum = 0;
+    append_to_disk(voltage);
+
 #if DEBUG_TO_SD
   write_Text_To_Disk("data.txt","Woke up, logging");
 #endif


   //update until we hit the specified number of minutes to run

#if 0
  Serial.print("clock.isAlarm1() " + String(clock.isAlarm1(false)) + " && (timeCount < (timeToSleep - 1)) : ");
  Serial.println(clock.isAlarm1(false) && (timeCount < (timeToSleep - 1)));
#endif


  // see if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {
#if DEBUG
    Serial.println("Card failed, or not present");
#endif
    // don't do anything more:
    return;
  }
