I've been trying to use 3 momentary footswitches on one analog input. I worked out some potential dividers values that give an analog input the following:
3.1v while pressing 1st FS
2.3v pressing FS1 simultaneously with a 2nd FS
1.5v nominal (no FS pressed)
0.93v pressing just FS2
0v while pressing a 3rd footswitch.
I soldered it up, fitted it to box and tested with multimeter. Reliably gives said voltages. Upon powering up Axoloti and connecting the GPIO Ain to a disp dial I get the expected even spread of 0, 18, 31, 45, 61 values when pressing the footswitches. I assumed (oh dear) I'd have a good enough resolution to create a simple AD converter with those voltage/k-rate signals. Unfortunately I've had a surprise!
So here is my patch so far...
For a start I have disp dial directly reading PC4 but it reacts unreliably to my switch presses. There is a visible lag between a switch press and the dial moving. Some presses it's almost instant, others it takes upto maybe 1/2 second. It always goes to the right value though. I'm pretty sure my footswitches are putting out the voltage when I press them (tested) and the delay is something to do with Axoloti. I also see this delay when setting parameters to be controlled by a 25k pot on another analog in and I see slow response when sending MIDI in to control parameters.
For the moment I am just putting up with this problem but it's not ideal, is this normal? If not any ideas why I could be experiencing such slow GPIO?
So next, the logicy bits. I guess the picture is fairly self explanatory?
The middle (voltage/value wise) functions have timers so they are not occasionally triggered as the voltage rushes up or down past them on it's way to 0v or 3.1v (that was happening). Funnily enough those 2 more complicated functions are the ones that are working the best. The most unreliable is the top one, which is also the simplest.
I've liberally employed disp bools all over the shop to try and debug this and they are acting strangely. At the top the input is compared to 9, if it's less it should trigger disp bool 1? that 1 output should also be toggled to a continuous 1 that keeps the next disp bool lit?
That's how I thought it would work and it does 80% of the time. However, sometimes I press it, see the initial value dial react (albeit slowly) and then maybe the first disp bool lights but the toggle doesnt light the 2nd disp bool. Or the 2nd disp bool correctly toggles on only to turn itself straight back off again. Or the 2 toggles do contradictory things. Or it works but with an annoying delay.
Although it works 80% of the time that is definitely not good enough for performance. Not quite sure what I'm doing wrong here, any hints/ideas/criticisms and witicisms are very welcome!