B&K user manual BK Precision 4071 User Manual Rev.2.2

Models: 4071

1 88
Download 88 pages 40.73 Kb
Page 85
Image 85

GetCommand:

CLS

PRINT : PRINT

PRINT " 1. Power on/off"

PRINT " 2. Channel Up"

PRINT " 3. Channel Down"

PRINT " 4. Volume Up"

PRINT " 5. Volume Down"

PRINT

PRINT " ESC To exit program"

PRINT

PRINT " Please select a command >"

CommandPoll:

a$ = INKEY$

IF a$ = "" THEN GOTO CommandPoll

IF a$ = CHR$(27) THEN SYSTEM

' Exit the program on ESC keypress

IF a$ < "1" OR a$ > "5" THEN GOTO GetCommand ' Is input valid?

PRINT : PRINT

 

 

 

PRINT "Command sent."

' Tell user command will be sent.

a = VAL(a$)

' Convert selection to a number, 1 to 5

NumPulses = Array(a)

 

' Look up no. of pulses for this command

'The variable NumPulses now has the number of infrared pulses to form this remote

'control command. Download this many "t" characters to the 4071 which causes it to

'trigger that many pulses in Burst mode.

a$ = STRING$(NumPulses, "t")

' Form a string with NumPulses number

'of "t" chars in it. I.e., if

'Numpulses=3, then a$="ttt"

PRINT #1, a$;

' Dump the "t"'s to the 4071

'The 4071 will now trigger a burst for each "t" char we sent it. After the 4071

'executes each "t" command, it will return a prompt character (">"). We wish to wait

'until after all prompts have come in, since that's when the 4071 has finished

'processing the last "t". The GetResponse1 subroutine has a time-out feature which will

'accomplish this purpose.

 

GOSUB GetResponse1

' Wait for and get response from 4071 to a$

 

GOTO GetCommand

' Go get another remote control command

'------------------------------------------------------------------------------

 

'------------------------------------------------------------------------------

 

'

SUBROUTINES

'------------------------------------------------------------------------------

 

'------------------------------------------------------------------------------

 

' The subroutines needed for this example are listed in Appendix A

80

BK Precision 4071 User Manual Rev.2.2

Page 85
Image 85
B&K user manual BK Precision 4071 User Manual Rev.2.2