Jump to content

AutoIT & Phidgets, Robotics with AutoIT (How To)


Recommended Posts

I am planning on building a "How To - AutoIT & Phidgets" and am looking for direction on how to document it.

Phidgets are "Products for USB Sensing and Control" that can be utilized with AutoIT. They allow physical

interface, functions and events / input and output through COM in the case of AutoIT. Check out the

Phidgets page for more information, and go to Trossen Robotics if you are going to buy (Cheaper and Faster).

The image is a link to the video right after I was able to get

AutoIT and the 1063 Bipolar stepper controllers talking. I

am building a 3-Axis CNC mill.

Posted Image

I Know AutoIT and Phidgets are not the ideal way to go when

building a mill... its a learning experience.

Quick piece together of code used in video above.

#include <GUIConstantsEx.au3>
 
GUICreate("PhidgetStepper Control Test",500,400)$Add_2C_B = GUICtrlCreateButton("Add to Current Position (+10000 1/16)", 5, 5, 490, 30)
$Sub_FC_B = GUICtrlCreateButton("Subtract from Current Position (-10000 1/16)", 5, 40, 490, 30)
$Output_E = GUICtrlCreateEdit("", 5, 335, 490, 60)GUISetState(@SW_SHOW)
;create the phidget object
$oPhidget = ObjCreate("phidget21COM.PhidgetStepper");open the Phidget system
$oPhidget.Open(130664)
$oPhidget.WaitForAttachment(3000)
If NOT $oPhidget.IsAttached Then
MsgBox(0, "Error", "Phidget Device not attached")
Exit
EndIf
;register Phidget events
$oPhidEvents = ObjEvent($oPhidget, "phid1_");Power Stepper Motor, index motor 0
$oPhidget.Engaged(0) = 1
;set Stepper control values
$oPhidget.CurrentLimit(0) = 00.70
$oPhidget.VelocityLimit(0) = 7000.00
$oPhidget.Acceleration(0) = 18100.00;set the current position
$oPhidget.CurrentPosition(0) = 0
;read current position to variable
$Current_P = $oPhidget.CurrentPosition(0)GUICtrlSetData($Output_E, $Current_P)
While 1
$msg = GUIGetMsg()Select
Case $msg = $GUI_EVENT_CLOSE
MsgBox(0,"Application Alert", "Application Closing")
ExitLoopCase $msg = $Add_2C_B
$Current_P = $oPhidget.CurrentPosition(0)
$oPhidget.TargetPosition(0) = $Current_P +10000
GUICtrlSetData($Output_E, $Current_P)
Case $msg = $Sub_FC_B
$Current_P = $oPhidget.CurrentPosition(0)
$oPhidget.TargetPosition(0) = $Current_P -10000
GUICtrlSetData($Output_E, $Current_P)
EndSelect
WEnd;power off stepper at index 0
$oPhidget.Engaged(0) = 0
;close
$oPhidget.Close();Phidget Event Handlers
Func phid1_OnDetach($Index, $IRValue)
MsgBox(0,"Error", "Phidget detached")
Exit
EndFunc

Sorry its one blob, it keeps coming out like that.

So where should I start a thread or threads, examples or questions, as it will be both and more.

I have a few different Phidgets and will be progressing the capabilities and limitations with the

help of the forum.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...