USB Joystick connected to PC and Arduino simultaneously ?

Hello and thank you for looking. I would like to run a mech game on a Windows 10 PC using a USB joystick. With that same joystick I would also like to move an arduino uno robot as a demonstrator.

One way would be to put dual pots in the joystick but I would rather do something on the software level in Windows 10.

Would any of you kind gentlemen or gentle ladies have any suggestions? And have a Happy 2020!!

Why not unplugg the joystick from the Pc and connect it to the Arduino, and vice versa?

If I connect the joystick to the arduino uno that works fine controlling the robot but how does the arduino control the windows software?

Railroader maybe could I use something like an Leonardo that emulates a joystick? Take commands from the joystick and move the robot via the Leo output, then have the Leo repeat the commands to windows 10 via USB cable???

“but how does the arduino control the windows software?”

You will probably have to do some windows programming to do that.

Okey, I get it.

Let one of the units, the Pc OR the Arduino supply the Vcc to the joystick. Onle one of them! Connect all their grounds together, Pc and Arduino. Then connect the output joystick signal, analog I suppose, to both Pc and Arduino.

Is this one of the projects from the "make a simple project as compolicated as it can get"-contest?

Cool Rail...I think you are talking about splitting out the USB joystick signal with a Y connector like setup(???) Send it to the PC and send it to the Arduino????

LOL zwieblum!! I am so stupid…sorry guys. I need to use the joystick for moving the mech in the software and move the physical robot at exactly the same time. Basically mirror the movements of the software robot with the demonstrator robot. Sorry guys for not being clear.

Well, make a small windows program: read joystick, send data to serial, repeat.

Hi Z, I tried doing something like that on another project and it was such a headache. I made a program in Processing but there was always what is called a “Windows Focus” problem. If I “focused” on the windows game (or made that window active) and played it the program would not run. If I “focused” on the App the program would run fine. That is why I am trying for a hardware fix that might be easier.

Of course you cannot connect the joystick to the Arduino via its USB connector (arguably, you could with a "Host shield" but ...). The suggestion to access the analog from the potentiometer implies that you connect internally to the joystick.

zwieblum:
Is this one of the projects from the "make a simple project as complicated as it can get"-contest?

Pretty much. :astonished:

This shouldn't be too difficult. Use the software USB library (V-USB) to read the joystick via the normal IO pins. Then use the hardware USB port on a Leonardo (or any 32u4 based board) to pass those readings on to the computer.

Thank you all for help and feedback...you guys are awesome...Chopsuwe that sounds like the best...gonna give it a try.