I haven’t seen a ton of Switch examples on here while I was looking around on how to accomplish this particular task. So I figured that now that I have it done and working, that I would turn around and share it.
I have a 4 button remote where each button supports pushed and held. It’s the Aeon Minimote. I wanted to create a piston that could handle all 8 possible events that the remote can perform. I wanted it to be a simple, easy to understand design, and something that would be easy to work on. This is what I came up with, and it works great!
I created a switch statement that generates a string by combining the button id (index) as well as the action type (value) of either “pushed” or “held”.