'{$STAMP BS2}
'define a variable of size
WORD
'name it speed
'it will be the speed at which
'we flash the LED
speed VAR WORD
infiniteLoop: 'label
HIGH 1 'discharge the capacitor
PAUSE 1 'for 1 milisecond
'check the time it takes to
charge
'and put the value in the variable speed
RCTIME 1,1,speed
'display the value of speed
on screen
DEBUG ? speed
'now flash the LED
GOSUB Flash
GOTO infiniteLoop 'loop
Flash: 'subroutine labeled
Flash
HIGH 0 'turn on LED
PAUSE speed 'wait x second
LOW 0 'turn off LED
PAUSE speed 'wait x second
RETURN 'go back to the rest
of the program