Velmex    |    BiSlide    |    XSlide
Image Fade Right
 
VXM Driver Documentation - Visual Basic 6 - 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.

Option Explicit
Public VXM As ClsVxmDriverVb6
Public AppPath As String

Private Sub Form_Load()
      Set VXM = New ClsVxmDriverVb6
      AppPath = App.Path
      Dim DriverLoaded As Long
      DriverLoaded = VXM.LoadDriver(AppPath + "\Driver\VxmDriver.dll")
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
      VXM.DriverTerminalShowState 0 'Use 0 to hide Terminal if was shown earlier
      VXM.PortClose 'Close the port in case still open
      VXM.ReleaseDriver
      Set VXM = Nothing
End Sub

Private Sub CmdMoveMotor_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.

Option Explicit
Public VXM As ClsVxmDriverVb6
Public AppPath As String

Private Sub Form_Load()
      Set VXM = New ClsVxmDriverVb6
      AppPath = App.Path
      Dim DriverLoaded As Long
      DriverLoaded = VXM.LoadDriver(AppPath + "\Driver\VxmDriver.dll")
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
      VXM.DriverTerminalShowState 0 'Use 0 to hide Terminal if was shown earlier
      VXM.PortClose 'Close the port in case still open
      VXM.ReleaseDriver
      Set VXM = Nothing
End Sub

Private Sub CmdMoveMotorWait_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