button
button copied to clipboard
Button initial state is wrong if it is pressed when arduino starts
If the button is pressed when you start the program, previousSteadyState is wrong, and you first need to wait for the button to be released for the ezbutton to start reflecting the real state.
Solution: previousSteadyState should be set to -1 and during the setup or the first loop detected as not yet HIGH or LOW and dealt with accordingly ( setting lastSteadyState to the opposite for the rest of the logic to work).