Sippeangelo Posted July 27, 2007 Share Posted July 27, 2007 Well i found this text about how to controll a USB Rocket Launcher with a dll in probably C++. This is the text: Howdy, I bought the same dreamcheeky rocket launcher to put it on my robot and it turned out the software from dreamcheeky sucks. After searching around and using this site as the starting point, I'm able to get a custom app working with it. I went ahead and created RocketLauncher.dll using UsbLibrary.dll from an article on Codeproject (http://www.codeproject.com/useritems/USB_HID.asp). I make the api as simple as possible to provide quick access to the launcher from people like me who just wanted an easy and quick way to incorporate it into our projects. Pretty simple to use. RocketLauncher.dll is .net library. I only tested it with dreamcheeky usb rocket launcher. The read values from the usb device is a little bit different from Brandon's values in comment one. Will explain further down. Here is a little details on the file, pretty easy to use: To use it with .net app: - Download UsbLibrary.dll from: http://home.myuw.net/tmn/UsbLibrary.dll - Download RocketLauncher.dll from http://home.myuw.net/tmn/RocketLauncher.dll - Put both files in the some directory and add reference to RocketLauncher.dll (no need to add ref to UsbLibrary.dll) - Create an instance of RocketLauncher.Launcher and have the following api available for you: SetDeviceInfo(): Allow you to set vendor id and product id. Currently, the default vendor id is 1941 and product id is 8021 if you use the default constructor. Connect() - must call this function first to load the rocket launcher before any movement. Up(), Right(), Left(), Down(), UpLeft(), UpRight(), DownLeft(), DownRight(), StopMoving(), Fire(), StopFiring(). OnDataReceived event let you get all the data (converted to string) sent from the usb device All moving already checks for the max values of left, right, up, down and will stop moving base on the following data received from usb: 0 64 0 0 0 0 0 0 0: max down 0 128 0 0 0 0 0 0 0: max up 0 0 4 0 0 0 0 0 0: max left 0 0 8 0 0 0 0 0 0: max right Sorry, I don't do any other fancy stuff since these APIs are just exactly what I need for my robot project. However, I leave the actual usb device within RocketLauncher.Launcher public so that anybody wants to do more things with it can go ahead. Make sure to check your vendor id and product id before using it and set it properly. (you can find them in the device manager session of your launcher). Cheers. Now, could someone tell me how to use these dlls in AutoIt? The original control program was relly crappy. I tried this in AutoIt to make it go Right but... DllCall("RocketLauncher.dll", "int", "Connect") Sleep(3000) DllCall("RocketLauncher.dll", "int", "Right") Is it anywhere close? This is how the rocket launcher looks: Link to comment Share on other sites More sharing options...
DW1 Posted July 27, 2007 Share Posted July 27, 2007 Please see DLLCall in my Sig AutoIt3 Online Help Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 27, 2007 Share Posted July 27, 2007 This is guessing from someone who is just now wanting to learn DLL calls. This seems to fit the pattern of other calls: expandcollapse popupHotKeySet("{ESC}", "_Quit") HotKeySet("{UP}", "_Arrows") HotKeySet("{DOWN}", "_Arrows") HotKeySet("{LEFT}", "_Arrows") HotKeySet("{RIGHT}", "_Arrows") HotKeySet("{SPACE}", "_Arrows") ; SPACE to stop HotKeySet("{ENTER}", "_Arrows") ; Enter to fire $DllFile = @ScriptDir & "/RocketLauncher.dll" $VendorID = 1941 $ProdID = 8021 $hDll = DllOpen($DllFile) DllCall($hDll, "int", "SetDeviceInfo", "int", $VendorID, "int", $ProdID) DllCall($hDll, "int", "Connect") While 1 Sleep(20) WEnd Func _Arrows() Local $DirKey = @HotKeyPressed Switch $DirKey Case "{UP}" ConsoleWrite("Debug: Rocket up" & @LF) DllCall($hDll, "int", "Up") Case "{DOWN}" ConsoleWrite("Debug: Rocket down" & @LF) DllCall($hDll, "int", "Down") Case "{LEFT}" ConsoleWrite("Debug: Rocket left" & @LF) DllCall($hDll, "int", "Left") Case "{RIGHT}" ConsoleWrite("Debug: Rocket right" & @LF) DllCall($hDll, "int", "Right") Case "{SPACE}" ; Stop ConsoleWrite("Debug: Rocket stop" & @LF) DllCall($hDll, "int", "StopFiring") DllCall($hDll, "int", "StopMoving") Case "{ENTER}" ; Fire ConsoleWrite("Debug: Rocket fire" & @LF) DllCall($hDll, "int", "Fire") EndSwitch EndFunc ;==>_Arrows Func _Quit() DllClose($hDll) Exit EndFunc ;==>_Quit It's all just speculation, 'cause I don't have one... (Please, Santa!) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Sippeangelo Posted July 27, 2007 Author Share Posted July 27, 2007 Wow that is great! Thank you soo much!! Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 27, 2007 Share Posted July 27, 2007 Wow that is great!Thank you soo much!! What's great? Did one of those versions work? Remember I can't test, and I'm a noob at DLL's too. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
weaponx Posted July 27, 2007 Share Posted July 27, 2007 This is the kind of stuff I like to see, a little creativity just for fun. P.S. I bet this thing really controls Goldeneye Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 27, 2007 Share Posted July 27, 2007 This is the kind of stuff I like to see, a little creativity just for fun.P.S. I bet this thing really controls GoldeneyeShuush! Don't say that in public! You know, adamantium is susceptible to powerful space-lasers... Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now