   measurevol();
   lcd.setCursor(0,1);
   lcd.print(tank);
-  int starttime = millis();
-  while (((millis()-starttime)<120000)&&(tank>23)){ } //2 min
-}
-void skim(){//skim during settle
+  float starttime = millis();
+  delay(100);
+  while (((millis()-starttime)<duration)&&(tank>lvl)){
+    delay(10000);
+    measurevol();
+  lcd.setCursor(0,1);
+  lcd.print(tank);} //2 min
+}
+void skim(float duration){//skim during settle
+  duration=duration*60*1000;
   lcd.clear();
   lcd.setCursor(0,0);
   lcd.print("Skim ");

int air = 9;
int stir = 8;
int depth = A0;
float tank;
void setup() {
  pinMode(en1, OUTPUT);


void measurevol(){
  int junk = analogRead(depth);
  float tank1 = analogRead(depth)*0.421569-28.4559;
  float tank2 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank3 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank4 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank5 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank6 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank7 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  float tank8 = analogRead(depth)*0.421569-28.4559;//*0.438596-32.7018;
  tank = (tank1 + tank2 + tank3 + tank4 + tank5 + tank6 + tank7 + tank8)/8;
}
