Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
'!TITLE "Variable"
Sub Main
Dim g_eng As Object
Dim g_ctrl As Object
Dim g_val as Object
'Connect RC: IP Setting depends on your RC setting
g_ctrl = cao.AddController("RC", "CaoProv.DENSO.RC8", "", "Server=192.168.0.1")
'Variable Name "IO150"
g_val = g_ctrl.AddVariable("IO150", "")
'Loop Starts
Do While 1
Select Case I[0]
'Read CaoVariable
Case 1
IO[128] = g_val.Value
I[0] = 0
'Write to CaoVariable
Case 2
g_val.Value = IO[129]
I[0] = 0
'Exit Program
Case 3
'Delete Variable Object
g_ctrl.Variables.Remove g_val.Index
'Delete Controller Object
cao.Controllers.Remove g_ctrl.Index
Exit Do
End Select
Loop
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.