Velmex    |    BiSlide    |    XSlide
Image Fade Right
 
VXM Driver Documentation - Visual Basic .NET 2003 - Examples
 
Image - VXM Image - Example

All functions assume you followed directions in the "How To Add To Your Project"

Examples

Minimal Code WITHOUT Wait

Below is the MINIMUM amount of code to make a motor move.

Public Function App_Path() As String
      Return System.AppDomain.CurrentDomain.BaseDirectory()
End Function

Private Vxm As ClsVxmDriverVbNet2003
Private DriverLoaded As Integer
Public AppPath As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Vxm = New ClsVxmDriverVbNet2003 'Set the class wrapper to use driver
      AppPath = App_Path()
      Dim DriverLoaded As Long
      DriverLoaded = Vxm.LoadDriver(AppPath + "Driver\VxmDriver.dll")
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
      Vxm.DriverTerminalShowState(0, 0) 'Use 0 to hide Terminal if was shown earlier
      VXM.PortClose 'Close the port in case still open
      VXM.ReleaseDriver
      VXM = Nothing
End Sub

Private Sub BtnMoveMotor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMoveMotor.Click
      Vxm.PortOpen(1, 9600)
      Vxm.PortSendCommands("F,C,I1M400,I1M-400,R")
      Vxm.PortClose()
End Sub



Minimal Code WITH Wait

Below is the MINIMUM amount of code to make a motor move if you want your code to wait for the VXM program to finish before your code continues.

Public Function App_Path() As String
      Return System.AppDomain.CurrentDomain.BaseDirectory()
End Function

Private Vxm As ClsVxmDriverVbNet2003
Private DriverLoaded As Integer
Public AppPath As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      Vxm = New ClsVxmDriverVbNet2003 'Set the class wrapper to use driver
      AppPath = App_Path()
      Dim DriverLoaded As Long
      DriverLoaded = Vxm.LoadDriver(AppPath + "Driver\VxmDriver.dll")
End Sub

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
      Vxm.DriverTerminalShowState(0, 0) 'Use 0 to hide Terminal if was shown earlier
      VXM.PortClose 'Close the port in case still open
      VXM.ReleaseDriver
      VXM = Nothing
End Sub

Private Sub BtnMoveMotorWait_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMoveMotorWait.Click
      Vxm.PortOpen(1, 9600)
      Vxm.PortSendCommands("F,C,I1M400,I1M-400,R")
      Vxm.PortWaitForChar("^", 0)
      Vxm.PortClose()
End Sub
Image Fade Bottom Image Fade Right Bottom