Inkey – Remote Processing CAMBASIC User Manual

Page 92

Advertising
background image

Comm ands - 59

INKEY$

Function

SYNTAX:

a$ = INKEY$( n)

PURPOSE:

To return a single character from a serial input buffer.

REMARK S:

The returned value is a null or one– character– length string.

n = valid serial port number, 1 or 2.

As long as there are characters in the input serial buffer, you may bring them out one at a time.
Each time INKE Y$ is executed, a character is removed from the buffer. The buffer is 255
character s.

RPC-2350 NOTE: The CAM BASIC statement BIT 128,4, 0 may need to be executed before you
will receive any characters. This command enables the CTS line to the sender.

RELATED:

C O M $ , I N P U T

EXAMPLE:

10 A$ = INKEY$(1)
20 IF A$ = "" THEN 10
30 IF A$ = "Y" THEN PRINT "YES"
40 IF A$ = "N" THEN PRINT "NO"
50 GOTO 10

ERROR:

< Illegal argument> – if n is not a legal port number
< Data negative> – for n

Advertising