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

ps2 button problem #10

Open
moxitpatelxolo opened this issue Jul 9, 2017 · 2 comments
Open

ps2 button problem #10

moxitpatelxolo opened this issue Jul 9, 2017 · 2 comments

Comments

@moxitpatelxolo
Copy link

while upload this code,
when i press one button then it will print two button

@ari86m
Copy link

ari86m commented Jul 9, 2017

I assume you are saying that when you press one button, the software reports another button has also been pressed. We have seen this behavior when using an off brand controller wired into an Arduino. It looks like there is some noise during communication. We don't see any error detection information in the data, so you would have to filter the data in software or do something to resolve the presumed noise problem. We saw some patterns in the incorrect packets received by an Arduino. Here are some things that could be done to prevent this.

Band-aid - Filter packet in the software:
1- discard any packet that contains more than 1 function (buttons & joysticks)
2- only keep packets that contain individual functions & combinations that should be allowed.
3- discard packets that match the finger prints of known incorrect packets.

Permanent fix in the hardware:
1- someone with an oscilloscope could see what the data signal really looked like at various locations in the hardware path of the signal & an "enthusiast" or engineer might be able to remedy the cause of the noise.

Good Luck!

@goatfanboi23
Copy link

I had a very similar problem when using an Arduino mega instead of an Uno (yes, I was using a cheap controller). I solved this problem by adding a delay of 10ms in the loop function. This completely eliminated buttons being registered twice and I have not had the problem since. I am not 100% sure why this works my thought is that maybe the increased clock frequency 8mhz (uno) to 16mhz (mega) lead to the library registering buttons twice. Hopes this helps anyone with this problem.

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

3 participants