NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages

This is an example of how to use the SetLongAbort function.

task main()
// Set exit button to end program only if it is pressed for longer than 2 seconds
// is equivalent to
// Display on NXT Screen: "Press the exit button longer (for 2 seconds) to exit"
TextOut(0, LCD_LINE1, "Press the exit", 0);
TextOut(0, LCD_LINE2, "button longer", 0);
TextOut(0, LCD_LINE3, "(for 2 seconds)", 0);
TextOut(0, LCD_LINE4, "to exit.", 0);
// Display number of times the user has pressed the exit button (for less than 2 seconds)
// Wait until user presses and releases exit button before continuing loop
while(!(ButtonPressed(BTNEXIT, 0)));
while(ButtonPressed(BTNEXIT, 0));