'!TITLE "FZ_Calibration"

' Attention
' 1. Set the EtherNet communication port for outputting result of Omron FZ to the same value of the line number 9 
' 2. Set the IP Address of the line number to that of Omron FZ
' 3. Open the TP panel after executing this PacScript 

' IP Address of the device
#define IPAddress "192.168.0.2"

Sub Main 
	Dim ctrl as object
	Dim vntResult as Variant

	' Connecting to FZ
	ctrl = Cao.AddController( "FZ", "CaoProv.OMRON.FZ", "", "conn=eth:" & IPAddress)

	Do
		On Error Resume Next
		' Obtaining trigger and results
		vntResult = ctrl.MEASURE
		
		' Converting results to variables so as to pass them to the TP panel
		vars.ItemValue(3) = vntResult(0)
		vars.ItemValue(4) = vntResult(1)
		PrintDbg vntResult(0) & ", " & vntResult(1) & ", " & vntResult(2)
		On Error Goto 0
	
		Delay 500
	Loop
End Sub



