I have this sketch that is connected to an arduino with two buttons and uses the oscP5 library. I have it configured so that the sketch sends an osc signal when both buttons have been pressed for over two seconds and resets the signal when one or both of the buttons become unpressed.
My problem is when both buttons are pressed and the signal is sent and then one is of the buttons is released that the signal resets straight away. I want the sketch to be able to wait for two seconds to check if the released button is pressed again in that time so that the signal will not reset or will wait for 2 seconds.
I'm basically trying to avoid an on/off glitchy situation. Any help would be greatly appreciated or any suggestions to improve the overall code.
int count; // How long the button was held (secs) int TimePressed; //time button has been HIGH for int check = 0; //check previous value of button int firstTime; // how long since the button was first pressed
//CODE FOR OSC SIGNALS OscP5 oscP5; NetAddress myBroadcastLocation;