- Serial Printing Sensors
Pushbutton State Change

Q: I’m a little confused about the last line lastButtonState = buttonState;.
Why do we make them equal if the states need to be saved separately?
Count Button Presses

When I pressed the button, the buttonPresses count increased rapidly. After I added delay(100), it increased more slowly.
Detecting Peak

PeakValue = highest value in given time
Threshold value can be changed based on the sensor
threshold = 50
- Sensitive: small changes/noise will easily trigger on
- More frequent, earlier responses (fires early on the rising edge)
threshold = 500
- Less sensitive: triggers only for stronger signals
- Fewer activations; delayed response (waits until the signal exceeds 500)