Page 1 of 1

How to use keyboard control for increase/decreasing values?

Posted: Thu Feb 06, 2025 4:02 am
by jimcortez
Working on an art installation that uses capacitive touch to manipulate animations over a matrix of LEDs. I have capacitive touch boards (adafruit MPR121) connected to a microcontroller (adafruit RP2040 QTpy). Using circuit python, I am able to use the HID module to make the board emit keyboard presses. I can then map these keyboard presses to inputs into ISF shaders to change the variables.

My goal is to map 2 keys to an "up" and "down" to a given variable so I can press-and-hold to increase or decrease. However, when using the keyboard control module, I can only get it to "toggle" between 2 values. How do I map a keyboard key to increase a value, then make it stay? Bonus points for being able to assign some sort of filter to make the increase/decrease smooth and driven by an increase/decrease in velocity.

Been trying to scour documentation on how to do this "1 direction" mapping of keyboard but coming up dry.

Re: How to use keyboard control for increase/decreasing values?

Posted: Fri Feb 07, 2025 3:46 am
by jimcortez
I ended up taking a different route and emulating a midi controller instead. This allowed me to emulate a slider, which has the flexibility I need.