TIB: Re: TI-Basic Digest V1 #467


[Prev][Next][Index][Thread]

TIB: Re: TI-Basic Digest V1 #467




here's a quick example of how you would have a program tell how long the key
was held down for.  i wrote it for my ti85 because i don't have an 83.  i
hope you can somehow get the idea and port it to your 83.

first it waits for any key to be held which is the first 'while-loop'.
next, it stores that value as something different and waits until that value
is not the same as what is being read anymore.  every loop it checks what's
currently being pressed to what was pressed, it increments 'B'.  once the
key is depressed, the second 'while-loop' is ended and the value of 'B' is
displayed added with 3 to compensate for the first loop's run time.  3 is
not an accurate number for the first 'while-loop's run time.  i hope this
helps.

jimi
=========================================
PROGRAM=KeyTime
:Disp "Hold key down now..."
:0(stored)B
:While A==0
:getKy(stored)A
:End
:While Ans==A
:getKy
:B+1(stored)B
:End
:Disp "You held that key","down for:",B+3,"seconds."
=========================================

<<Using a TI-83 is there any way to find out how long a user has held down
a key? It would be simple if it weren't for the fact that a variable
gotten by something like this:
getKey->A
is constantly being reset to zero when a key is not being pressed.
How, if there is indeed a way, can it be done?>>