BASIC commands
PROGRAMMING MANUAL
181
R
e
vi
si
o
n
1
.0
fig. 60
/i
fig. 61
/i
Example
Run an axis in reverse. When it reaches a certain position, slow down.
DEFPOS(0) ' set starting position to zero
REVERSE
WAIT UNTIL MPOS<-129.45
SPEED=slow_speed
WAIT UNTIL VP_SPEED=slow_speed ' wait until the axis slows
OP(11,ON) ' turn on an output to show that speed is now slow
Example
A joystick is used to control the speed of a platform. A deadband is required to
prevent oscillations from the joystick midpoint. This is done with the
REVERSE
command, which sets the correct direction relative to the operator.
Then, the joystick adjusts the speed through analog input 0.
REVERSE
WHILE IN(2)=ON
IF AIN(0)<50 AND AIN(0)>-50 THEN 'sets a deadband in the input
SPEED=0
ELSE
SPEED=AIN(0)*100 'sets speed to a scale of AIN
ENDIF
WEND
CANCEL
See also
AXIS
,
CANCEL
,
FORWARD
,
RAPIDSTOP
.