Skip to content

Instantly share code, notes, and snippets.

@trentbrooks
Last active August 29, 2015 13:56
Show Gist options
  • Save trentbrooks/8969897 to your computer and use it in GitHub Desktop.
Save trentbrooks/8969897 to your computer and use it in GitHub Desktop.
for kurt
int previousStatus = 0; // 0 = nothing, 1 = hand above head
int resetStatusCounter = 0;
int resetStatusThreshold = 100;
void draw() {
// do normal kinect updates and processing here (your code)
int status = ?; // you need to work out when hand is above, etc
if(status == 0) {
// nothing happening no need to change anything
} else if(status == 1) {
// hand is above, trigger keypress if this is a new status
if(status != previousStatus) {
sendYourCustomKeypressCommand(); // your code to send keypress commands
resetStatusCounter = 0; // reset the counter
} else {
// hand is still above, but we already sent the keypress command, so do nothing until the counter resets
resetStatusCounter++; // increment the counter
if(resetStatusCounter == resetStatusThreshold) {
previousStatus = 0;
resetStatusCounter = 0;
}
}
}
previousStatus = status;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment