Controlling a servo with XNA and an Xbox 360 Controller

Well, since my PS2 controller is having problems again (as usual), I felt like using my Xbox 360 controller instead. How do I do this you might add? I did it using Microsoft XNA. I know how to use XNA, I have been learning it since version 1.0 and I had created several small 2D games. I never thought how handy it could be for robotics. Think about it. It’s capable of doing all the hard 3D work for you, so you can easily create 3D robot simulators. I have not done this yet since the math involved in 3D programs is a little too much for me right now.

Anyways, for simple things like controlling a servo, the Xbox controller does a magnificent job at it. It’s also very precise. the only problem I seem to be having with it is the servo moves in the opposite direction of the thumbstick. I’m sure that could be easily fixed though.

Take a look at the Video.
youtube.com/watch?v=CVlgLFErad4

Download the source code here:
ssc32xbox.codeplex.com/

BTW sorry about the background noise. my pc is so loud… :blush:

Edit: Ok, It’s been about 5 mins now and I already fixed the problem. :slight_smile:

Hi Wowy7,

Great job on the XBOX controller. Does XNA support the XBOX controller with a default library? I’m only familiar with Visual studio and never used XNA. XNA is using C# right?

I’m using the DIY-RC since the PS2 controller doesn’t give me the wanted precision. Have you compared the XBOX controller with a SONY ps2 remote or another brand PS2 remote?

Keep up the good work!

Xan

Hey Xan!

Yes, the Xbox controller is supported by the XNA framework. the amazing thing is it only takes a few lines of code to work. XNA runs off of C#, and there are really good tutorials out there to get started.

I have noticed the Xbox controller does get much better precision then the PS2 controller.

Thanks!

Brandon C.

Hi Brandon, Xan,

Two good ideas! I know nothing about XNA framework, or Xbox for that matter.

The DIY-RC might be a way to go. When I get time, I’ll look into it!

Thanks!

Alan KM6VV