Programming: Push Button to Activate Code when Pressed and Released

How to make a program for the push button switch for an Atmel AVR microcontroller so that the action is only activated when the push button is pressed then released. A condition using the function bit_is_clear is used to test for the push button press and then a variable is used to determine pressed state and released state. Within the condition, there is another condition to determine if the push button is in the released state before the push button is pressed. This means that the push button must have been released before the push button pressed action is invoked.



Back to blog

Leave a comment

Please note, comments need to be approved before they are published.