srkn
srkn

Reputation: 35

Sending an analog input to the system

I'm trying to make a joystick. The idea is that I will get an analog input from a pot by arduino I'll send the value to visual studio via serial port and finally I have to put this value as joystick analog input to the system so I'll be able to use it in the games but I couldn't find the command to do this.

I found a command like SendKey and I tried it but the result isn't what I needed. For example if I use the SendKey.Send("a") the car in the game acts fully turned to left. I want to use the potentiometer like an analog stick. If I turn the pot half way, the steering wheel will turn half way.

Upvotes: 0

Views: 1026

Answers (1)

user3704293
user3704293

Reputation: 1056

I think it would be definitely a better idea to implement a HID joystick profile instead handling serial data and create a virtual joystick in windows via C#. But if it is very important for you to have a virtual joystick check the vJoy project.

As I mentioned above, I would implement a HID Joystick profile. You can do that in many ways and it is not complicated at all.

For example use a Arduino board that have a native supports of joystick HID profile (such as the Teensy Boards), use a Arduino which you can modify to use a Joystick library (e.g. USBAPI) (like the Arduino Leonardo boards, instructions see here), or use a compatible bluetooth module with HID firmware, such as the RN42 HID from Sparkfun. There are several example codes for that application in the web.

Upvotes: 1

Related Questions