 
 int PIStates[] = { 1, 1 };
 int lastStates[] = { 1, 1 };
-bool justMoved[] = { true, true };
+int lastTime[] = { 0, 0 };
 int pelletCount[] = { 0, 0 };
 
 #define FILENAME "PelletData.csv"


    logData();
    updateDisplay();
    justMoved[inputNum] = false;
  }
  else if (PIStates[inputNum] == 1) {
    //need to replace pellet
    if (!justMoved[inputNum]) {
      Serial.print(F("Replacing pellet #"));
      Serial.print(String(inputNum + 1));
      Serial.println(F("..."));
      moveMotor(inputNum);
      justMoved[inputNum] = true;
    }
    else
    { delay(500); justMoved[inputNum] = false; }
  }
  
  else if (PIStates[inputNum] == 0 & PIStates[inputNum] != lastStates[inputNum]) {

    Serial.print(F("Pellet #"));
    Serial.print(String(inputNum + 1));
    Serial.println(F(" replaced"));
    lastTime[inputNum] = 0;
  }
  
  else  { //if PIStates == 0
    //pellet still there, do nothing
    lastStates[inputNum] = PIStates[inputNum];
    lastTime[inputNum] = 0;
    return false;
  }
  lastStates[inputNum] = PIStates[inputNum];
