'MD2xp2.bas - Example Program
'Demonstrates Loops and Gosubs

'Enable MD2
MD2MOTOR=1  : MD2ON

'Relative Moves.
MD2MOVETYPE="R" 
 
'Home both motors.
gosub 02

'Start outside loop.
MD2LOOPCOUNT1=2

    'Move X axis.
    MD2TARGET(1)=100 :MD2MOTOR=1: MD2MOVE

    'Inside Loop.
    MD2LOOPCOUNT2=3

        'Move Y axis.
        Gosub 01

    MD2LOOP2

MD2LOOP1

'Home both motors.
gosub 02

'Disable MD2
MD2MOTOR=1  : MD2OFF

Beep

End



$01
'Move Y axis and delay
MD2TARGET(2)=100 : MD2MOTOR=2: MD2MOVE
sleep .5
return


$02
'Home both motors
MD2MOTOR=1
MD2HOME
MD2MOTOR=2
MD2HOME
return

