how do you capture the top value in a fallen edge in analogs data (flex sensor)
I suggest you consider as “top value of the falling edge” the maximum of
the values you have read during a specified time window before the edge
is detected. This means you have to compute the maximum at the time you
detect the edge. If you instead continuously compute a running maximum,
then you are going to get a global maximum. Amended source:

bool loaded = false;
int threshold = 760;
int index = 0 ;
const int values_size = 4;  // this controls the time window
int values[values_size];

void setup() {
  Serial.begin(9600);
}

void loop() {
  int data = analogRead(A0);

  if (loaded) {
    // Store the reading.
    values[index] = data;
    index = (index + 1) % values_size;

    // Detect falling edge.
    if (data &lt; threshold) {
      loaded = false;

      // Find the max.
      int _max = 0;
      for (int i = 0; i &lt; values_size; i++) {
        if (values[i] &gt; _max) _max = values[i];
        values[i] = 0;  // clear, for next time
      }

      // Report it.
      Serial.flush();
      Serial.print('a');
      Serial.print(',');
      Serial.print(_max);
      Serial.println();
      delay(300);
    }
  }

  // Detect rising edge.
  else if (!loaded &amp;&amp; data &gt; threshold) {
    loaded = true;
  }
  delay(20);
}


Notice the line values[i] = 0;. It is intended to avoid the reading of
one falling edge being seen on the next one.