For anyone interested, here's the final code I ended up with.
const int lengthIntervalFilter = 300;
unsigned beginningFilterInterval, currentMillis;
float currentBellowsPressure = 0;
float lastBellowsPressure = 0;
const float BELLOWS_RELEASE_CONSTANT = .5;
const float BELLOWS_FILL_CONSTANT = .6;
void loop {
currentMillis = millis();
if (currentMillis - beginningFilterInterval >= lengthIntervalFilter) {
beginningFilterInterval += lengthIntervalFilter;
float footpedal = (float)analogRead(A20);
currentBellowsPressure = (1 - BELLOWS_RELEASE_CONSTANT) * lastBellowsPressure + BELLOWS_FILL_CONSTANT * footpedal;
if (currentBellowsPressure > 1024) {
currentBellowsPressure = 1024.00;
}
Serial.println( currentBellowsPressure );
Serial.println( footpedal );
lastBellowsPressure = currentBellowsPressure;
}
}
The footpedal is just a pot hooked up to an analog pin.
I put a max pressure on the bellows and am still messing with the FILL / RELEASE constants.
Thank you so much for all of the advice and brainstorming.