 
 int x0data[32], x1data[32], y0data[32], y1data[32], z0data[32], z1data[32];
 int xdata[32], ydata[32], zdata[32];
-int pdata[4];
-int Acal1, Acal2, Acal3, Acal4;
 unsigned long DataInterval;
-double Adata[8], A1data[8], A2data[8], A3data[8], A4data[8];
+double Adata[8];
 float RoomTemp, Thermocouple;
-double Pressure, PTemp, Pressure1, PTemp1, Pressure2, PTemp2;
 String event;
 
-//int configAcc(String command);  // function declaration for calibration
 int configInterval(String interval);
 HighTemp ht1(A1, A0);
 HighTemp ht2(A5, A4);

  // calculate amplitude by summing the squares, divide vectors by 100 to keep number manageable
      Adata[f] += (xdata[i]*xdata[i])/100 + (ydata[i]*ydata[i])/100 + (zdata[i]*zdata[i])/100;
    }
    Adata[f] = sqrt(Adata[f]);  // Amplitude = squareroot of sum of the squares
  }
}


  EEPROM.get(addr, nvmobj);       // read EEPROM data
  if (nvmobj.verifyEE == 0xaa55)  // if the verification value is true
  {
    DataInterval = nvmobj.interval; // retrieve interval value from EEPROM
  }
  else { DataInterval = OneMin;}  // otherwise, set interval to 1 min
}

void loop()
{
  RoomTemp = ht1.getRoomTmp();      // read and calculate room temp 1
  Thermocouple = ht1.getThmc();     // read and calculate thermocouple temp 1
  SwitchMux(0x01);                  // switch to i2c mux input 1
  ReadAccelerometer(GAccI2C);       // read the accelerometer
  event = "Pump1Acc1";
  PublishData();                    // publish data to Particle cloud
  SwitchMux(0x02);                  // switch to i2c mux input 2
  ReadAccelerometer(GAccI2C);       // read the accelerometer
  event = "Pump1Acc2";
  PublishData();                    // publish data to Particle cloud
  RoomTemp = ht2.getRoomTmp();      // read and calculate room temp 2
  Thermocouple = ht2.getThmc();     // read and calculate thermocouple temp 2
  SwitchMux(0x04);                  // switch to i2c mux input 1
  ReadAccelerometer(GAccI2C);       // read the accelerometer
  event = "Pump2Acc3";
  PublishData();                    // publish data to Particle cloud
  SwitchMux(0x08);                  // switch to i2c mux input 1
  ReadAccelerometer(GAccI2C);       // read the accelerometer
  event = "Pump2Acc4";
  PublishData();                    // publish data to Particle cloud
  delay(DataInterval);              // wait interval, then repeat main loop
}

void ReadAccelerometer(int i2c_address)   // function to read/average accelerometer values
