#define BTN 7
#define SerialRate 115200
int button;
float buttonSmoothed;
float buttonBefore;
void setup()
{
Serial.begin(SerialRate);
pinMode(BTN, INPUT_PULLUP);
}
void loop()
{
button = digitalRead(BTN);
button = button * 100;
buttonSmoothed = (button * 0.05) + (buttonBefore * 0.96);
buttonBefore = buttonSmoothed;
Serial.println(buttonSmoothed);
delay(10);
}