I have used 'for loop' to test for switch press duration as such....you would use your adc reading instead of GPIO check
Code:
if GPIO.1= 1 then start ' gpio is 1 for no press, 0 for pressed....or do 1 adc read and check ..about 100 microseconds
FOR B5= 1 TO 100 '1 SECOND FOR TIMER
PAUSE 10
if GPIO.1= 1 then start 'or do 1 adc read and check ..about 100 microseconds
NEXT B5
'''' switch still pressed ...continue to 2 second press check
FOR B5 = 1 TO 100 '2 SECONDS FOR 6 HR
PAUSE 10
if GPIO.1=1 then TIMER 'press is greater than 1 second in this loop... up to 2 second
NEXT B5
continuing here if switch still pressed !!!!
Bookmarks