Need help by converting a old gameport joystick to usb

Hi, i need some help converting a old gameport joy stick... I have this simple code that
just outputs the X and Y axis of the joystick by reading analog input:

#define SW 4

void setup() {
  Serial.begin(9600);
  pinMode(SW,INPUT);
  digitalWrite(SW,HIGH);
}

void loop() {
  Serial.print("VRX_value=");
  int X_value=analogRead(A3);
  Serial.print(X_value);
  Serial.print("\t");

  Serial.print("VRY_value=");
  int Y_value=analogRead(A4);
  Serial.print(Y_value);
  Serial.print("\t");

  Serial.print("Switch_value=");
  int switch_value=digitalRead(SW);
  Serial.print(switch_value);
  Serial.println("\t");

  delay(1000);
  

}

My only issue that i dont have a leonardo which lets you act as a keyboard or mouse,etc
only the arduino uno, and also the code cant do that.. i also heard some arduino unos have the same chip as the leonardo but i think i have the atmega something something.. Any posibility i can make a virtural joystick using some sort of software..
if possible i need windows and linux solutions...

Cheers :smiley:

Have you seen this?
GitHub - jdelacroix/arduino_usb_gameport: A USB-to-Gameport joystick adapter implemented on the Arduino.

what is that not sure, how do i use i

Sorry, it's not super clear, but there's a link to the entire project there.
Here it is too:
Using a PC Joystick with the Arduino | Built to Spec (built-to-spec.com)

hmm yeah its basicly the same code i have it just reads analog voltage and just prints it into the serial monitor..

Here's a better article on the HID side of the interface:
Making an Arduino Human Interface Device (HID) - OKdo

This will only work on certain Arduinos, the Leonardo, Micro, Zero and Due (or any 32U4 based board). This is because they have a USB module built in whereas something like the Uno or the Mega does not.

i found a better way https://www.instructables.com/Convert-an-Old-Game-Port-Joystick-Into-a-Usb-Fligh/

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.