Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make a paddle controller for pong on pc #61

Open
Marvan0305 opened this issue Dec 29, 2023 · 4 comments
Open

How to make a paddle controller for pong on pc #61

Marvan0305 opened this issue Dec 29, 2023 · 4 comments

Comments

@Marvan0305
Copy link

Marvan0305 commented Dec 29, 2023

Hey can someone help me make a paddle controller with an arduino uno so i can play pong on my pc.
Like this instructables page: https://www.instructables.com/USB-Paddle-Game-Controller/

@Marvan0305 Marvan0305 changed the title Hos to make a paddle controller for pong on pc How to make a paddle controller for pong on pc Dec 29, 2023
@Marvan0305
Copy link
Author

I have 2 10kΩ potentiometer and 2 buttons.

@AlanChatham
Copy link
Owner

Hi! Sorry this is as late as it is, but if you're still working on this, you could probably get away with just using the UnoJoyArduinoSample.ino code, connecting your potentiometer to 5v, GND, and the middle pole to A0 on the Arduino? Then the buttons connect between ground and whatever digital pins give you the buttons that you need.

I hope this helps!

@Marvan0305
Copy link
Author

Hi thanks for the anwser. I got the controllers working but the paddle is still moving when i stop rotating. I'm using a steam game called project:pong which is only has keyboard support. So i need to find another way to make paddle controllers for the game.

@AlanChatham
Copy link
Owner

I wondered about that, if the controls were "paddle position is mapped to the joystick's position" like actual pong, vs. the apparent behavior of "moving the stick in one direction makes the paddle move that direction".

You're probably going to be unable to make a potentiometer work in this case, since it's always going to be stuck in a physical range between it's minimum and maximum, and there won't be a sensible way to calibrate that against whatever position the paddle in the game starts at, and even then, it would be very difficult to exactly map the game paddle range with the physical position of the potentiometer, and you'd still get drift issues that would eventually make it so your on-screen paddle would stop before it hit the end of the screen, but you've moved the potentiometer to it's physical edge.

However, if you got a rotary encoder, you could easily make this controller, you'd just have to compare rotary encoder positions across each loop, and if the encoder position changed, you'd set the joystick to left or right depending on which direction the change was, and center the joystick position in the code if there was no change.

Hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants