[#CODING4FUN] XBoxOne Controller and USB Rocket Launcher

Hello!

Let’s start in the end of the post with the output video

Now a little explanation on how to assemble this. I used the basis of my post about How to control with C# XBoxOne command. Then with a bit of code to control the rocket launcher, I get to connect both devices and the fun starts.

The complete solution includes 3 projects, 1 is responsible for controlling the Rocket Launcher, then the app WPF to coordinate signals of the remote control and the Lance missiles. Finally I have a PCL that is responsible for translating Int32 values from the command in command more basic type: up, down, left or right.

image

Actually, the work has not been very complicated, the only thing I had to keep in mind is the values that sends the controller. After seeing that the GamePad moves in the range of an Int32, the best thing was to define values for LeftFar > Left > Center > Right > RightFar, with values between – 20000 > – 10000 > 0 > 10000 > 20000. In this way a kind MoveControler helped me to translate these values the position of the joystick on the remote control.

The example is pretty simple, since I use the classes that I have created in previous posts to control the Lance missiles. For example

In this example I have left out the “corners”, I have to update the class RocketController to support this elegantly Winking smile

By the way, the full code can be downloaded from here: http://1drv.ms/1pQDQQx

Important: I deleted the NuGet packages so that the code is not very heavy, please download them again to be able to compile the solution.

References

https://elbruno.com/2014/06/27/coding4fun-xboxone-game-controller-c-fun-time/

http://1drv.ms/1pQDQQx

Saludos @ Home

El Bruno

image image image Google
Advertisements

4 thoughts on “[#CODING4FUN] XBoxOne Controller and USB Rocket Launcher”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.