
Originally Posted by
Robson
Hello grandpa,
Maybe this can be good for you.
Code:
Button VAR PORTB.0 ' Your Input switch
Loop VAR WORD
InputButton:
IF Button = 1 THEN Check4Button
GOTO InputButton
Check4Button:
FOR Loop = 0 TO 1000 ' 1 Second
PAUSE 1
IF Button = 0 THEN Stop ' If button was released before 1 Sec = short keypress
NEXT Loop
IF Button = 1 THEN Park ' If button was hold longer than 1 Sec = long keypress
GOTO InputButton
Stop:
' Here is your code
Park:
' Here is your other code
END
regards Rob
Something to pay attention for:
Button and Stop are reserved words =>> they are commands.
You may want to rename them as Btn and Stp.
============================
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Bookmarks