Did you know that you can use Arduino to turn on an LED when you press a button? Well, it is true, you can do this! Leaving the joke aside, let me show how you can achieve this. You will need the ...
Notice the two voltage thresholds that the inverter uses: on the way up, it switches around 3.3V, and on the way down, around 1.5V. I cherry-picked these two fairly bad transitions for the graphs here ...