Problem with reading voltages and possible code faults.

void setup() {

  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  delay(3000);

  val = analogRead(2);
  delay(500);
  val1 = analogRead(2);
  
  addfloat = val + val1;
  
  finalval = addfloat / 2;

  if (finalval >= 700) {
    buzz = 591;
    cut = 570;
  }
  else if ( finalval >= 450) {
    buzz = 398;
    cut = 367;
  }
}

setup() execute only one time

val = analogRead(2);
delay(500);
val1 = analogRead(2);

What is the status of your battery when you run this first time? it would be nice if you post all calculations with little detail :wink:

val = analogRead(2);
delay(300);
val1 = analogRead(2);
delay(300);
val2 = analogRead(2);
delay(300);
val3 = analogRead(2);

val = val1 = val2 = val3 most probably why?