-
Notifications
You must be signed in to change notification settings - Fork 401
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
Changing pins in GamepadExample triggers up randomly #41
Comments
Please post your sketch file and describe how you are wiring up the buttons. |
Hi Matthew, thanks for your reply. I'm just using the GamepadExample sketch you've provided. The only thing I've changed are the 5 pinModes:
The worst part is that the issue happens without anything connected to the Leonardo, as well. Doesn't happen if I just upload the untouched example, though. Buttons (and the stick) are just wired up with a common ground to GND and the other wire to the various digital pins (I'm usually testing with 2 to 7). Thanks again. |
When nothing is connected to an arduino pin, you cannot guarantee what the voltage/digital reading of that pin will be. |
Right, I know as much - but I've tested it with everything connected to it as well and the issue still manifests itself in the same exact way. |
He used the INPUT_PULLUP on them, which enables the weak pull-up in the Avr, which should be sufficient/equivalent to an external weak pull-up resistor
Sent from my fancy-schmancy phone.
… On Apr 6, 2017, at 7:05 AM, Graham Reeves ***@***.***> wrote:
When nothing is connected to an arduino pin, you cannot guarantee what the voltage/digital reading of that pin will be.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@jbenam Can you post your entire sketch file? The issue may be in how you are processing the inputs or how you are sending them to the Joystick library. |
@MHeironimus
Just uploaded this to my Leonardo and it's going bonkers - it goes up all by itself randomly. |
@jbenam The only thing I see wrong with your sketch file is the following line:
should read
assuming you want pin 3 to be up, pin 4 to be right, 5 to be down, 6 to be left, and 7 to be fire. I uploaded your sketch (which the change above) to my Leonardo and it worked without error. You may want to try to get your hands on another Leonardo or Micro and see if you can reproduce the issue. |
They are equivalent.
Pi
Sent from my fancy-schmancy phone.
… On Apr 15, 2017, at 2:51 AM, Andrea ***@***.***> wrote:
aren't you supposed to initialize the buttons pins to HIGH as described here?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
They are equivalent:
E.g.:
pinMode( pin, INPUT );
digitalWrite( pin, HIGH );
Is the same as:
pinMode( pin, INPUT_PULLUP );
…-s
Sent from my fancy-schmancy phone.
On Apr 15, 2017, at 2:51 AM, Andrea ***@***.***> wrote:
aren't you supposed to initialize the buttons pins to HIGH as described here?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
I have to say I got the same issues, but in my case I did some changes for using more buttons. |
this might help with your problem, i used arrays to store the pins.
|
This is what I ended up doing instead, works pretty well:
|
@jbenam Glad to hear you found a solution. |
Hi, thanks for your work on this library - much appreciated!
I've recently bought an Arduino Leonardo just for this project (genuine one, not a clone, in case it matters) but I'm having some trouble changing the pins from GamepadExample.
If for example I just change pins 2 to 6 with pins 3 to 7, the emulated pad starts going bananas with up being randomly triggered (touching the Arduino makes it trigger more often). And that's with NOTHING connected to it! I'm kinda new to Arduino, so I might be missing something terribly straightforward.
The issue is only exacerbated by adding more buttons. Then it starts doing all kinds of funny stuffs (triggering button 0 repeatedly, going down-left like mad, etc). The only thing that seems to be working right is a vanilla GamepadExample - as soon as I change the pins, it goes totally nuts. Maybe my Arduino is faulty?
Thanks for your help!
The text was updated successfully, but these errors were encountered: