In this recipe, we will learn how to call a function when the state of a button has changed. It is a common requirement that you only want an action to be performed when a button has a state change, as opposed to while the button is pushed down. This recipe demonstrates one technique that you can use to implement this requirement in your project.
Calling functions on the button state change
Getting ready
You will need access to the REPL on the Circuit Playground Express to run the code presented in this recipe.
How to do it...
Let's perform the following steps:
- First...