I frequently use an IR clicker to enter data into my programs. This little subroutine is handy to use & it corrects the offset that comes from the numeric keys.
Jims
Code:
'########################################################
'##subroutine to get data from an IR CLICKER & correct
'##the offset from the numeric keys. 20M2 chip.
'#########################################################
symbol ir_clicker=B.0 'B.0 (pin 18 on 20m2)
symbol irdata=b0 'variable b0
get_1IR: '##Subroutine
irin ir_clicker,irdata 'Get data from the IR clicker on B.0 &
'put the data in variable b0.
if irdata=<9 then let irdata=irdata+1:endif 'Correct numeric keys 1 thru 9.
if irdata=10 then let irdata=0:endif 'Correct the 0 key.
pause 10 'Probably don't need this pause.
return 'clicker data will be in variable b0 when returm to
' main program.