![Opt OPT-DPA1024E-4 Скачать руководство пользователя страница 26](http://html1.mh-extra.com/html/opt/opt-dpa1024e-4/opt-dpa1024e-4_manual_1640664026.webp)
OPT MACHINE VISION TECH.CO. LTD
ADD:8 JingSheng Road, JingXia ChangAn DongGuan China 523853
TEL: 0769-82716188 FAX: 0769-81606698
E-mail:
Website:Http://www.optmv.net
26
//Destroy the connection
int ret = 0;
ret = OptController.DestoryEtheConnect();
if (0 != ret)
{
Console.WriteLine("Failed to destroy the connection");
}
else
{
Console.WriteLine("DONE");
}
Console.ReadKey();
}
}
}
Note: Please tick “Allow unsafe code” in (ProjectName — Properties — Build).
1.4.2 An example in VC++
//Connect to controller
OPTController_InitSerialPort(W2A(strCOMName.GetBuffer(0)), &m_OPTControllerHandle);
// OPTController_CreateEtheConnectionBySN(W2A(strSNe.GetBuffer(0)), &m_OPTControllerHandle);
// OPTController_DestoryEtheConnection(m_OPTControllerHandle);
// Turn on the 1st channel
OPTController_TurnOnChannel ( m_OPTControllerHanlde , 1 ) ;
//Turn off the 1st channel
OPTController_TurnOffChannel( m_OPTControllerHanlde , 1 ) ;
// Set the intensity 255 to the 3rd channel
OPTController_SetIntensity( m_OPTControllerHanlde ,3 , 255 ) ;
// Destroy the connection with the controller
// OPTController_DestoryEtheConnection(m_OPTControllerHandle);
OPTController_ReleaseSerailPort(m_OPTControllerHandle);
1.4.3 An example in VB
'Create a connection to the controller