David Pilling |
Main »
Stepper DLLThis is a Windows DLL which allows applications to control a stepper motor via an Arduino shield (see Stepper). Mostly the functions map to commands sent to the Arduino and are documented in the command section on the Stepper page. Downloads: Functions supplied
Initialise the module, find Arduino COM port, call before anything else, returns 0 on success
Move steps with interval in ms between them in direction (0 or 1). outputs ignored.
Stop motor. outputs ignored
Sets power to the motor off
Fills in M1Active and M1Steps from last number of steps set with RunMotor1()
The functions above emulate the Stepper Bee library.
Do Arduino rs command
Do Arduino sp command
Do Arduino ac command
Do Arduino mv command
Do Arduino mt command
Do Arduino sc command
Do Arduino ss command
Do Arduino pw command
Do Arduino wr command
Do Arduino ai command
Do Arduino ri command
Send a command to Arduino.
Get response from Arduino. delay is time to wait for a response in ms.
Do Arduino ps command
Do Arduino ds command
Do Arduino rd command
Print a string to debug window
See if a move has completed, returns non-zero on success. Returns position after move. delay is time to wait for a result in ms.
Visual Basic 2010 definitions Declare Function InitStp2 Lib "stpDP.dll" (ByVal ipaddress As String, ByVal port As Integer) As Integer Declare Function SetSpeedMotor1 Lib "stpDP.dll" (ByVal speed As Integer) As Boolean Declare Function SetAccelerationMotor1 Lib "stpDP.dll" (ByVal acceleration As Integer) As Boolean Declare Function MoveMotor1 Lib "stpDP.dll" (ByVal steps As Integer) As Boolean Declare Function MoveToMotor1 Lib "stpDP.dll" (ByVal steps As Integer) As Boolean Declare Function StepSizeMotor1 Lib "stpDP.dll" (ByVal ms As Integer) As Boolean Declare Function PowerMotor1 Lib "stpDP.dll" (ByVal pw As Integer) As Boolean Declare Function SendCommand Lib "stpDP.dll" (ByVal command As String) As Boolean Declare Function GetResponse Lib "stpDP.dll" (ByRef response As String, ByVal delay As Integer) As Boolean Declare Function GetPosition Lib "stpDP.dll" () As Integer Declare Function GetDistanceToGo Lib "stpDP.dll" () As Integer Declare Function TestMoveOver Lib "stpDP.dll" (ByRef posn As Integer, ByVal delay As Integer) As Boolean Declare Function RunSpeed Lib "stpDP.dll" (ByVal speed As Integer) As Boolean Declare Function RemInterrupt Lib "stpDP.dll" (ByVal interrupt As Integer) As Boolean Declare Function ReadPin Lib "stpDP.dll" (ByVal pin As Integer) As Integer Declare Function SetCurPos Lib "stpDP.dll" (ByVal steps As Integer) As Boolean Declare Function ArmInterrupt Lib "stpDP.dll" (ByVal interrupt As Integer, ByVal mode As Integer) As Boolean Declare Function WritePin Lib "stpDP.dll" (ByVal pin As Integer, ByVal value As Integer) As Boolean Declare Function TestSensor Lib "stpDP.dll" (ByVal pin As Integer) As Integer Declare Function ResetArduino Lib "stpDP.dll" (ByVal delay As Integer) As Integer Declare Function GetProcessor Lib "stpDP.dll" () As Integer Declare Function SetCancelState Lib "stpDP.dll" (ByVal state As Integer) As Integer |
David Pilling's Wiki Set view |
Page last modified on March 16, 2016, at 03:03 PM - Powered by PmWiki pmwiki-2.3.31 (pmwiki-2.3.31) |