User`s guide

Detecting User Input
Input from the pendant can be received in two ways:
l A series of button presses from the data-entry buttons can be read. The READ
instruction is used to receive this type of input.
l A single-button press from any of the buttons can be detected. These single-button
presses can be monitored in three different modes:
l The buttons can be monitored like keys on a normal keyboard.
l The buttons can be monitored in toggle mode (on or off). The state of
the button is changed each time the button is pressed.
l The keys can be monitored in level mode. The state of the button is
considered "on" only when the button is held down.
The PENDANT() function is used to detect button presses in these modes. The KEYMODE
instruction is used to set the button behavior.
Using READ With the Pendant
The READ instruction accepts input from the pendant data-entry Buttons (1, 2, 3, 4, 5, 6, 7,
8, 9, 0, ., +, -). A READ instruction expects a <CR-LF> to indicate the end of data entry. On
the pendant, this sequence is sent by the REC/DONE button (similar to the Enter or Return
key on a normal keyboard). The DEL button behaves like the Backspace key on a normal
keyboard. All other pendant buttons are ignored by the READ instruction. Note that the
predefined function buttons are active and may be used while an attached program is
waiting for input. See the Adept T1 Pendant User’s Guide or Adept T2 Pendant User’s Guide
for more information on the predefined buttons.
The instruction line:
READ (1) $response
causes the program to wait for input from the pendant. The user must signal the end of the
input by pressing the REC/DONE button. The input is stored in the string variable
$response.
The input can be stored in a real variable, but then the + and - buttons must be used in the
input only to identify the sign of the variable (for example, -12.34 or +12.34). If a real
variable is specified in the READ instruction, and the + or - characters are used in a different
way, such as 11+1 or ++97, the READ instruction will issue an error. For example, entering
11+1 will result in the following error message:
*Unexpected text at end of line*
and ++97 will cause this error message:
*Invalid number format*
Detecting User Input
(Undefined variable: Primary.Product_Name_V)Language User's Guide, version
17.x
Page 287