8-68 Trio BASIC Commands
Program Loops and Structures
Trio Motion Technology
Example 1:
FOR opnum=10 TO 18
OP(opnum,ON)
NEXT opnum
This loop sets outputs 10 to 18 ON.
Example 2:
loop:
FOR dist=5 TO -5 STEP -0.25
MOVEABS(dist)
GOSUB pick_up
NEXT dist
Example 3:
FOR.. NEXT
statements may be nested (up to 8 deep) provided the inner
FOR
and
NEXT
commands are both within the outer
FOR..NEXT
loop:
FOR x=1 TO 8
FOR y=1 TO 6
MOVEABS(x*100,y*100)
WAIT IDLE
GOSUB operation
NEXT l2
NEXT l1
Note:
FOR..NEXT
loops can be nested up to 8 deep in each program.
GOSUB
Type:
Program Structure
Syntax:
GOSUB label
Description:
Stores the position of the line after the
GOSUB
command and then branches to the
line specified. Upon reaching the
RETURN
statement, control is returned to the
stored line.
end:
A valid Trio BASIC expression.
increment:
A valid Trio BASIC expression. (Optional)