how to read more than one keypress at a time
in
Programming Questions
•
3 years ago
apologies if this has been asked before.
I've got a sketch where I want to be able to "chord" keypresses - you hold down one key, then another, and both key presses can be detected.
Here's the code...
Is there any way to detect when the user has held down multiple keys?
thanks,
Steve
I've got a sketch where I want to be able to "chord" keypresses - you hold down one key, then another, and both key presses can be detected.
Here's the code...
- void keyPressed() {
- if (key=='p') lambda0+=.025;
- if (key=='o') lambda0-=.025;
- if (key=='q') theta1+=.025;
- if (key=='a') theta1-=.025;
- if (key==' ') {
- lambda0=0;
- theta1=0;
- }
- }
Is there any way to detect when the user has held down multiple keys?
thanks,
Steve
1