I have completed the rewrite of the code with a more sensitive detection for gesture thresholds instead of using states. By saving the past value in the code, I am able to detect if the opening or closing gestures are occurring for over 100 milliseconds. This can be changed depending on how the program is calibrated. The code was commented to show each step of the implementation.
Another way this could have been achieved would be with different boolean flags and use of the millis() function.
Alternatively, the program could have also been made in a way that sets thresholds on the sensor value instead of time.
https://pastebin.com/Uk4MMP7k
No comments:
Post a Comment