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

slightly wrong check for pressed buttons on SNES-pad #5

Open
GoogleCodeExporter opened this issue Mar 22, 2015 · 1 comment
Open

slightly wrong check for pressed buttons on SNES-pad #5

GoogleCodeExporter opened this issue Mar 22, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

Hi,
in the "SNESpad_LED"-example I noticed that the LED for button A doesn't work 
and a look into the header revealed: 
#define SNES_A       0x100
#define SNES_X       0x200
#define SNES_L       0x400
#define SNES_R       0x800
So I tested it for A,X,L,R: all 4 are not working.

digitalWrite(5,  state & SNES_A );

I don't know the signature of the digitalWrite function but it seems that there 
is some implicit cast or an overflow wich prevents that 4 buttons (which are 
bits 9-12 in the 'state' variable) testing the value to 'greater than 0' before 
passing it to the function solves the problem:

digitalWrite(5, (state & SNES_A)>0 );

Anyway, this lib is great, it is easy to use and you have 12 buttons in no time 
:D thanks for publishing it.

Original issue reported on code.google.com by [email protected] on 6 Jan 2011 at 9:56

@GoogleCodeExporter
Copy link
Author

ah, forgot to mention:
That might be the problem of S.MartelJr (comment #1 in issue #1).

Original comment by [email protected] on 6 Jan 2011 at 9:58

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

No branches or pull requests

1 participant