// collect data for 50 mS and then plot data while (millis() - startMillis < sampleWindow) { sample = analogRead(AMP_PIN); if (sample < 1024) // toss out spurious readings { if (sample > signalMax) { signalMax = sample; // save just the max levels } elseif (sample < signalMin) { signalMin = sample; // save just the min levels } } } peakToPeak = signalMax - signalMin; // max - min = peak-peak amplitude Serial.println(peakToPeak); //double volts = (peakToPeak * 5.0) / 1024; // convert to volts //Serial.println(volts); }