 boolean showLCD = true;
 unsigned long lastVibration;
 boolean lastMotorState = false;
+
+
+const int numReadings = 40;
+
+int percentReadings[numReadings];
+int percentIndex = 0;    
+long percentTotal = 0; 
+
+int milliVoltReadings[numReadings];
+int milliVoltIndex = 0;     
+long milliVoltTotal = 0;     
+
+
 
 void setup() {
 

}


void writeVoltageToDisplayBuffer(int batteryMilliVolt){
  uView.setFontType(0);
  uView.setCursor(0,32);


  float voltage = (float) batteryMilliVolt / 1000;

  char buff[6];
  String voltageString = dtostrf(voltage, 4, 2, buff);

  uView.print(voltageString);
  uView.print("V");

  int batteryRange = MAX_BATTERY_MILLIVOLT - MIN_BATTERY_MILLIVOLT;

  //Cast to long as Arduino int is only 16 bits wide. Not enough to hold this result
  long numerator =  ((long) ((batteryMilliVolt - MIN_BATTERY_MILLIVOLT))) * 100;
  int batteryPercent = numerator / batteryRange;

  if(batteryPercent < 100){
    uView.setCursor(47,32);

    long vccVoltage = getVcc();
    //Serial.println(vccVoltage);
    int batteryMilliVolt = ((long) voltageADCReading * vccVoltage) / ADC_PRECISION;



    writeTimeToDisplayBuffer(now, blinkOn, secondsBlink);
    writeAlarmToDisplayBuffer(blinkOn);
