Last active
August 29, 2015 13:56
-
-
Save trentbrooks/8969897 to your computer and use it in GitHub Desktop.
for kurt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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