' Added the Following error 7/21/05 Brian
rem   modified 06/17/2005 by Jim  Cullins of  Sound Logic
Option Explicit
Dim   XPos, YPos, ZPos, Xenc, Yenc, Zenc,Xtemp,Ytemp,Ztemp,Following_Error
Following_Error = GetOEMDRO (1050)
XPos = GetOEMDRO(83)
Xenc = GetPARAM ("Encoder1")
If ABS(Xenc - XPos) > Following_Error then
    Call DoOEMButton (1001)         
    CALL  SetUserLED  (1004, 1)                    ' turn LED on
    Xtemp = 1
 else    
    CALL SetUserLED (1004,0)                      ' turn LED OFF     
    Xtemp = 0
 END If

YPos = getOEMDRO (84)
Yenc = getPARAM ("Encoder2")
If ABS(Yenc - YPos) > Following_Error then
   Call DoOEMButton (1001)
   CALL SetUserLED (1005, 1)                       ' turn LED on  
   Ytemp = 1
 else    
  CALL  SetUserLED (1005,0)                        ' turn LED OFF   
   Ytemp = 0
END IF

ZPos = getOEMDRO (85)
Zenc = getPARAM ("Encoder3")
If ABS(Zenc - ZPos) > Following_Error then
  Call DoOEMButton (1001)
  CALL   SetUserLED (1006, 1)                       ' turn LED on
  Ztemp =1
    else    
  CALL  SetUserLED (1006,0)                        ' turn LED OFF  
  Ztemp = 0
END IF
If  (Xtemp + Ytemp + Ztemp )>0 then
   ActivateSignal( 11 )
else
   DeActivateSignal( 11 ) 
End if
