I'm using some pots multiplexed to a Teensy 3.0, and some momentary switches connected straight to the Teensy. With the help of this board and posted examples as well as arduino code from here and the web, I've got the multiplexed pots putting data into PD as well as the switches.
I want to have the momentary switches control toggles, and change toggle state each time the switch is pressed. I have done:
switch input (coming from repack)
|
[sel 1]
|
[toggle]
This works to flip the switch upon pressing, but it's like the toggle bounces and doesn't always latch or change state. The X in the toggle will flicker and sometimes it will latch, sometimes not. The same goes for untoggling, sometimes it works, sometimes not. I thought maybe the arduino was bouncing so I added code to debounce for 200ms. Doesn't change anything.
If I don't use the sel and just have a toggle coming from repack, the toggle is solid when I hold the switch down. Only when I try to [sel 1] does it seem to have issues. When the toggle has latched it is solid though.
Initially I was only using one switch so I didn't have the second repack object, just a number coming from the second output of the first repack. Trying to put this number into sel did the same thing.
I've attached the patch and ino if you want to review. Any ideas how to get rid of this bouncing/timing issue?