rupello

Joystick inputs seem mixed-up in Gameduino example

Recommended Posts

I'm a newbie trying out the Gameduino samples and having a problem with my joystick, which I think is a clone of the old Atari 2600 style.

 

When I run the joytest sample my left, right, and back work OK, but the 'forward' direction gets triggered by the orange button, and moving the stick forward has no effect. I've tried a few different pin numbers at random without any success. In trying to debug this I am struggling to understand how the pins in the code below relate to the pin numbers in the hardware guide. http://papilio.cc/index.php?n=Papilio.ClassicComputingShield#joystick

 

 

void loop()
{
  GD.putstr(40, 10, digitalRead(5) ? "-" : "F");   // maps to my orange button
  GD.putstr(40, 20, digitalRead(6) ? "-" : "D");   // works
  GD.putstr(35, 15, digitalRead(7) ? "-" : "L");   // works
  GD.putstr(45, 15, digitalRead(8) ? "-" : "R");   // works 
 
  //GD.putstr(17, 24, digitalRead(2) ? "-" : "S"); // always on (if I un-comment this)
 

 

Any insights appreciated,

 

Rupert

Share this post


Link to post
Share on other sites

I havent used gameduino yet

 

and i know you marked some as // works, but try it to see what happens.

       GD.putstr(40, 10, digitalRead(13) ? "-" : "F"); 

  GD.putstr(40, 20, digitalRead(11) ? "-" : "D"); 
  GD.putstr(35, 15, digitalRead(9) ? "-" : "L");  
  GD.putstr(45, 15, digitalRead(8) ? "-" : "R");  
 
  GD.putstr(17, 24, digitalRead(12) ? "-" : "S"); // fire button?
 
 

Share this post


Link to post
Share on other sites

OK - I looked at the circuit diagram and see that only four of the joystick switches are mapped - no FWD for some reason - and the joytest example has the pins mixed-up which confused me further

 

https://dl.dropboxusercontent.com/u/138749/perma/joystick-pins.png

 

You should definitely check-out the gameduino though as it is awesome. I came down this rabbit-hole trying to get the frog to move properly in the frogger tutorial so I should be able to fix that now!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now