I'm trying to demonstrate how using a state machine can clarify the logic of most Raspberry Pi projects. All of the code is available as a gist, but the problem portion is around line 34:
The state machine is designed to use a button (momentary latch) to toggle an LED on and off in a reasonable fashion (push-release, light turns on; push-release, light turns off).
The code works as listed in the gist, but as soon as you comment out the
sleep call the behavior changes to (push, light turns on; release, light turns off).
Given the real-time nature of the Pi, I believe this pause impacts it in a way that would not apply to a simulated environment. I'm pretty sure it's a Pi-specific issue.
What could be going on, here?