In this recipe, we will create the first version of our touch handler. This first version will play a specific audio file each time a touch event is detected. We can then use this handler in later recipes, in order to map each touchpad to a specific audio file. We will also expand the functionality of this handler in future recipes to add light, as well as sound, to the touch event. Event handlers are a common part of many software systems. This recipe will help you see how you can use this common approach with your MicroPython projects.
Creating a touch handler to play sounds
Getting ready
You will need access to the REPL on Circuit Playground Express to run the code presented in this recipe.