Is there a way to distinguish between quickly pressing a button and holding it down?
you can use a timer to measure how long the button was held down, here’s an example.
task main()
{
while(true) {
wait1Msec(20);
// detect button press
if( vexRT Btn8D ] == 1 ) {
// reset timer to 0
clearTimer( T1 );
// wait for button release
while( vexRT Btn8D ] == 1 ) {
wait1Msec(5);
}
// how long was press ? more than 1/2 second ?
if( time1[T1] > 500 ) {
writeDebugStreamLine("long press");
}
else {
writeDebugStreamLine("short press");
}
}
}
}